@ -0,0 +1,39 @@ | |||||
#built application files | |||||
*.apk | |||||
*.ap_ | |||||
# files for the dex VM | |||||
*.dex | |||||
# Java class files | |||||
*.class | |||||
# generated files | |||||
bin/ | |||||
gen/ | |||||
# Local configuration file (sdk path, etc) | |||||
local.properties | |||||
# Windows thumbnail db | |||||
Thumbs.db | |||||
# OSX files | |||||
.DS_Store | |||||
# Android Studio | |||||
*.iml | |||||
.idea | |||||
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs. | |||||
.gradle | |||||
build/ | |||||
.navigation | |||||
captures/ | |||||
output.json | |||||
#NDK | |||||
obj/ | |||||
.externalNativeBuild | |||||
@ -0,0 +1 @@ | |||||
/build |
@ -0,0 +1,93 @@ | |||||
plugins { | |||||
id 'com.android.application' | |||||
id 'org.jetbrains.kotlin.android' | |||||
id 'kotlin-parcelize' | |||||
id 'maven-publish' | |||||
} | |||||
publishing { | |||||
publications { | |||||
mavenJava(MavenPublication) { | |||||
groupId = 'com.nivesh.production.bajajfd.Manoj.Singh' | |||||
artifactId = 'library' | |||||
version = '1.0' | |||||
} | |||||
} | |||||
} | |||||
android { | |||||
namespace 'com.nivesh.production.bajajfd' | |||||
compileSdk 33 | |||||
defaultConfig { | |||||
applicationId "com.nivesh.production.bajajfd" | |||||
minSdk 21 | |||||
targetSdk 33 | |||||
versionCode 1 | |||||
versionName "1.0" | |||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||||
} | |||||
buildTypes { | |||||
release { | |||||
minifyEnabled false | |||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |||||
consumerProguardFiles 'proguard-rules.pro' | |||||
} | |||||
} | |||||
compileOptions { | |||||
sourceCompatibility JavaVersion.VERSION_1_8 | |||||
targetCompatibility JavaVersion.VERSION_1_8 | |||||
} | |||||
kotlinOptions { | |||||
jvmTarget = '1.8' | |||||
} | |||||
buildFeatures { | |||||
viewBinding true | |||||
} | |||||
} | |||||
ext{ | |||||
roomVersion="2.4.3" | |||||
glideVersion="4.11.0" | |||||
} | |||||
dependencies { | |||||
implementation 'androidx.core:core-ktx:1.9.0' | |||||
implementation 'androidx.appcompat:appcompat:1.5.1' | |||||
implementation 'com.google.android.material:material:1.7.0' | |||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | |||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0' | |||||
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1' | |||||
testImplementation 'junit:junit:4.13.2' | |||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | |||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | |||||
// Architectural Components | |||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" | |||||
// Coroutines | |||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1' | |||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1' | |||||
// Coroutine Lifecycle Scopes | |||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" | |||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" | |||||
//test | |||||
// Retrofit | |||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0' | |||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0' | |||||
implementation "com.squareup.okhttp3:logging-interceptor:4.7.2" | |||||
// Navigation Components | |||||
implementation "androidx.navigation:navigation-fragment-ktx:2.5.3" | |||||
implementation "androidx.navigation:navigation-ui-ktx:2.5.3" | |||||
//Preference | |||||
implementation 'androidx.preference:preference:1.2.0' | |||||
} |
@ -0,0 +1,21 @@ | |||||
# Add project specific ProGuard rules here. | |||||
# You can control the set of applied configuration files using the | |||||
# proguardFiles setting in build.gradle. | |||||
# | |||||
# For more details, see | |||||
# http://developer.android.com/guide/developing/tools/proguard.html | |||||
# If your project uses WebView with JS, uncomment the following | |||||
# and specify the fully qualified class name to the JavaScript interface | |||||
# class: | |||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |||||
# public *; | |||||
#} | |||||
# Uncomment this to preserve the line number information for | |||||
# debugging stack traces. | |||||
#-keepattributes SourceFile,LineNumberTable | |||||
# If you keep the line number information, uncomment this to | |||||
# hide the original source file name. | |||||
#-renamesourcefileattribute SourceFile |
@ -0,0 +1,24 @@ | |||||
package com.nivesh.production.bajajfd | |||||
import androidx.test.platform.app.InstrumentationRegistry | |||||
import androidx.test.ext.junit.runners.AndroidJUnit4 | |||||
import org.junit.Test | |||||
import org.junit.runner.RunWith | |||||
import org.junit.Assert.* | |||||
/** | |||||
* Instrumented test, which will execute on an Android device. | |||||
* | |||||
* See [testing documentation](http://d.android.com/tools/testing). | |||||
*/ | |||||
@RunWith(AndroidJUnit4::class) | |||||
class ExampleInstrumentedTest { | |||||
@Test | |||||
fun useAppContext() { | |||||
// Context of the app under test. | |||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | |||||
assertEquals("com.nivesh.production.bajajfd", appContext.packageName) | |||||
} | |||||
} |
@ -0,0 +1,61 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |||||
xmlns:tools="http://schemas.android.com/tools"> | |||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |||||
<uses-permission android:name="android.permission.INTERNET" /> | |||||
<uses-permission | |||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |||||
<uses-permission android:name="android.permission.CAMERA" /> | |||||
<uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE" /> | |||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> | |||||
<uses-feature | |||||
android:name="android.hardware.camera" | |||||
android:required="false" /> | |||||
<uses-feature | |||||
android:name="android.hardware.camera.autofocus" | |||||
android:required="false" /> | |||||
<uses-feature | |||||
android:name="android.hardware.camera.flash" | |||||
android:required="false" /> | |||||
<application | |||||
android:allowBackup="false" | |||||
android:dataExtractionRules="@xml/data_extraction_rules" | |||||
android:fullBackupContent="@xml/backup_rules" | |||||
android:icon="@mipmap/ic_launcher" | |||||
android:label="@string/appName" | |||||
android:roundIcon="@mipmap/ic_launcher_round" | |||||
android:supportsRtl="true" | |||||
android:theme="@style/Theme.NiveshFDSDK" | |||||
tools:targetApi="31"> | |||||
<activity | |||||
android:name=".ui.activity.BajajFdMainActivity" | |||||
android:exported="true" | |||||
android:windowSoftInputMode="adjustPan"> | |||||
<intent-filter> | |||||
<action android:name="android.intent.action.MAIN" /> | |||||
<category android:name="android.intent.category.LAUNCHER" /> | |||||
</intent-filter> | |||||
<meta-data | |||||
android:name="android.app.lib_name" | |||||
android:value="" /> | |||||
</activity> | |||||
<provider | |||||
android:name="androidx.core.content.FileProvider" | |||||
android:authorities="${applicationId}.provider" | |||||
android:exported="false" | |||||
android:grantUriPermissions="true"> | |||||
<meta-data | |||||
android:name="android.support.FILE_PROVIDER_PATHS" | |||||
android:resource="@xml/file_paths" /> | |||||
</provider> | |||||
</application> | |||||
</manifest> |
@ -0,0 +1,17 @@ | |||||
package com.nivesh.production.bajajfd | |||||
import android.app.Application | |||||
import android.content.Context | |||||
class BajajApplication : Application() { | |||||
private var mInstance: BajajApplication? = null | |||||
companion object { | |||||
var appContext: Context? = null | |||||
} | |||||
override fun onCreate() { | |||||
super.onCreate() | |||||
mInstance = this | |||||
appContext = applicationContext | |||||
} | |||||
} |
@ -0,0 +1,83 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import android.widget.ImageView | |||||
import android.widget.TextView | |||||
import androidx.recyclerview.widget.RecyclerView | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.model.ClientBanklist | |||||
class BankListAdapter( | |||||
private val bankList: List<ClientBanklist>?, | |||||
private val selectedAccount: String? = null, | |||||
private val width: Double? | |||||
) : RecyclerView.Adapter<BankListAdapter.BankListViewHolder>() { | |||||
inner class BankListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |||||
val bankSelector: ImageView = itemView.findViewById(R.id.bankSelector) | |||||
val tvBankName: TextView = itemView.findViewById(R.id.tvBankName) | |||||
val tvBankAccountNumber: TextView = itemView.findViewById(R.id.tvBankAccountNumber) | |||||
val tvBankIFSC: TextView = itemView.findViewById(R.id.tvBankIFSC) | |||||
} | |||||
private var checkedPosition: Int = -2 | |||||
override fun onCreateViewHolder( | |||||
parent: ViewGroup, | |||||
viewType: Int | |||||
): BankListViewHolder { | |||||
val view = LayoutInflater.from(parent.context) | |||||
.inflate(R.layout.item_bank_list_preview, parent, false); | |||||
view.layoutParams = width?.div(1.35) | |||||
?.let { ViewGroup.LayoutParams(it.toInt(), ViewGroup.LayoutParams.WRAP_CONTENT) } | |||||
return BankListViewHolder(view) | |||||
} | |||||
override fun onBindViewHolder(holder: BankListViewHolder, position: Int) { | |||||
val bankList = bankList?.get(position) | |||||
if (bankList != null) { | |||||
holder.itemView.apply { | |||||
holder.tvBankName.text = bankList.BankName | |||||
holder.tvBankIFSC.text = bankList.IFSCCode | |||||
holder.tvBankAccountNumber.text = bankList.AccountNumber | |||||
if (selectedAccount == bankList.AccountNumber && (checkedPosition == -2)) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
checkedPosition = holder.adapterPosition | |||||
} else if (checkedPosition == -1) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_outline) | |||||
} else if (checkedPosition == holder.adapterPosition) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
} else { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_outline) | |||||
} | |||||
holder.itemView.setOnClickListener { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
if (checkedPosition != holder.adapterPosition) { | |||||
notifyItemChanged(checkedPosition) | |||||
checkedPosition = holder.adapterPosition | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
override fun getItemCount(): Int { | |||||
return bankList?.size!! | |||||
} | |||||
private var onItemClickListener: ((ClientBanklist) -> Unit)? = null | |||||
fun setOnItemClickListener(listener: (ClientBanklist) -> Unit) { | |||||
onItemClickListener = listener | |||||
} | |||||
fun getSelected(): ClientBanklist? { | |||||
return if (checkedPosition != -1) { | |||||
bankList?.get(checkedPosition) | |||||
} else null | |||||
} | |||||
} |
@ -0,0 +1,47 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import android.widget.TextView | |||||
import androidx.recyclerview.widget.RecyclerView | |||||
import com.google.android.material.switchmaterial.SwitchMaterial | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.model.GetCodes | |||||
class CustomerListAdapter( | |||||
private val customerList: MutableList<GetCodes>? | |||||
) : RecyclerView.Adapter<CustomerListAdapter.BankListViewHolder>() { | |||||
inner class BankListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |||||
val tvCustomerName: SwitchMaterial = itemView.findViewById(R.id.tvCustomerName) | |||||
val txtLabel: TextView = itemView.findViewById(R.id.txtLabel) | |||||
} | |||||
override fun onCreateViewHolder( | |||||
parent: ViewGroup, | |||||
viewType: Int | |||||
): BankListViewHolder { | |||||
return BankListViewHolder( | |||||
LayoutInflater.from(parent.context).inflate( | |||||
R.layout.item_customer_list_preview, | |||||
parent, | |||||
false | |||||
) | |||||
) | |||||
} | |||||
override fun onBindViewHolder(holder: BankListViewHolder, position: Int) { | |||||
val cList = customerList?.get(position) | |||||
if (cList != null) { | |||||
holder.txtLabel.text = cList.Label | |||||
holder.tvCustomerName.setOnCheckedChangeListener { _, isChecked -> | |||||
cList.isSelected = isChecked | |||||
} | |||||
} | |||||
} | |||||
override fun getItemCount(): Int { | |||||
return customerList?.size!! | |||||
} | |||||
} |
@ -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 | |||||
} | |||||
} |
@ -0,0 +1,124 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import ROIDataList | |||||
import android.annotation.SuppressLint | |||||
import android.app.Activity | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import android.widget.LinearLayout | |||||
import android.widget.TextView | |||||
import androidx.core.content.ContextCompat | |||||
import androidx.core.content.res.ResourcesCompat | |||||
import androidx.recyclerview.widget.RecyclerView | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.adapter.HorizontalRecyclerViewAdapter.HistoryAdapterViewHolder2 | |||||
import com.nivesh.production.bajajfd.interfaces.OnClickListener | |||||
class HorizontalRecyclerViewAdapter( | |||||
private val activity: Activity, | |||||
dropdownList: MutableList<ROIDataList>, | |||||
onClickListener: OnClickListener | |||||
) : RecyclerView.Adapter<HistoryAdapterViewHolder2>() { | |||||
private var dropdownList: MutableList<ROIDataList> | |||||
private var rowIndex = -1 | |||||
private var onClickListener: OnClickListener | |||||
inner class HistoryAdapterViewHolder2(view: View?) : RecyclerView.ViewHolder( | |||||
view!! | |||||
) { | |||||
var txtYear: TextView = itemView.findViewById(R.id.txtYear) | |||||
var txtInterestRate: TextView = itemView.findViewById(R.id.txtInterestRate) | |||||
var rlParent: LinearLayout = itemView.findViewById(R.id.rlParent) | |||||
} | |||||
init { | |||||
this.dropdownList = dropdownList | |||||
this.onClickListener = onClickListener | |||||
} | |||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HistoryAdapterViewHolder2 { | |||||
val itemView = | |||||
LayoutInflater.from(parent.context).inflate(R.layout.row_dropdown, parent, false) | |||||
return HistoryAdapterViewHolder2(itemView) | |||||
} | |||||
override fun onBindViewHolder( | |||||
holder: HistoryAdapterViewHolder2, | |||||
@SuppressLint("RecyclerView") position: Int | |||||
) { | |||||
if (dropdownList.isNotEmpty()) { | |||||
val roiDataList: ROIDataList = dropdownList[position] | |||||
getYear(holder.txtYear, roiDataList, holder) | |||||
holder.txtInterestRate.text = roiDataList.ROI.toString().plus(" % ") | |||||
holder.rlParent.setOnClickListener { | |||||
rowIndex = position | |||||
notifyDataSetChanged() | |||||
} | |||||
if (rowIndex == position) { | |||||
onClickListener.onclickCategory(position) | |||||
holder.txtYear.background = | |||||
ResourcesCompat.getDrawable( | |||||
activity.resources, | |||||
R.drawable.rounded_corner_green_fill, | |||||
null | |||||
) | |||||
holder.txtYear.setTextColor(ContextCompat.getColor(activity, R.color.white)) | |||||
} else { | |||||
holder.txtYear.background = | |||||
ResourcesCompat.getDrawable( | |||||
activity.resources, | |||||
R.drawable.rounded_corner_with_line, | |||||
null | |||||
) | |||||
holder.txtYear.setTextColor( | |||||
ContextCompat.getColor(activity, R.color.black) | |||||
) | |||||
} | |||||
} | |||||
} | |||||
private fun getYear(txtYear: TextView, option: ROIDataList, holder: HistoryAdapterViewHolder2) { | |||||
when (option.Tenure) { | |||||
"12" -> { | |||||
holder.rlParent.visibility = View.VISIBLE | |||||
txtYear.text = activity.getString(R.string.OneYear) | |||||
} | |||||
"24" -> { | |||||
holder.rlParent.visibility = View.VISIBLE | |||||
txtYear.text = activity.getString(R.string.TwoYears) | |||||
} | |||||
"36" -> { | |||||
holder.rlParent.visibility = View.VISIBLE | |||||
txtYear.text = activity.getString(R.string.ThreeYears) | |||||
} | |||||
"48" -> { | |||||
holder.rlParent.visibility = View.VISIBLE | |||||
txtYear.text = activity.getString(R.string.FourYears) | |||||
} | |||||
"60" -> { | |||||
holder.rlParent.visibility = View.VISIBLE | |||||
txtYear.text = activity.getString(R.string.FiveYears) | |||||
} | |||||
else -> { | |||||
holder.rlParent.visibility = View.GONE | |||||
} | |||||
} | |||||
} | |||||
override fun getItemCount(): Int { | |||||
return dropdownList.size | |||||
} | |||||
override fun getItemViewType(position: Int): Int { | |||||
return position | |||||
} | |||||
fun refresh() { | |||||
rowIndex = -1 | |||||
notifyDataSetChanged() | |||||
} | |||||
} |
@ -0,0 +1,94 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import android.widget.ImageView | |||||
import android.widget.TextView | |||||
import androidx.recyclerview.widget.RecyclerView | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.model.GetCodes | |||||
class PaymentModeAdapter( | |||||
private val bankList: List<GetCodes>?, | |||||
private val selectedAccount: String? = null | |||||
) : RecyclerView.Adapter<PaymentModeAdapter.BankListViewHolder>() { | |||||
inner class BankListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |||||
val bankSelector: ImageView = itemView.findViewById(R.id.bankSelector) | |||||
val tvBankName: TextView = itemView.findViewById(R.id.tvBankName) | |||||
val tvUpiMsg: TextView = itemView.findViewById(R.id.tvUpiMsg) | |||||
} | |||||
private var checkedPosition: Int = -2 | |||||
override fun onCreateViewHolder( | |||||
parent: ViewGroup, | |||||
viewType: Int | |||||
): BankListViewHolder { | |||||
return BankListViewHolder( | |||||
LayoutInflater.from(parent.context).inflate( | |||||
R.layout.item_payment_list_preview, | |||||
parent, | |||||
false | |||||
) | |||||
) | |||||
} | |||||
override fun onBindViewHolder(holder: BankListViewHolder, position: Int) { | |||||
val bankList = bankList?.get(position) | |||||
if (bankList != null) { | |||||
holder.itemView.apply { | |||||
holder.tvBankName.text = bankList.Value | |||||
if (bankList.Value.equals("UPI")){ | |||||
holder.tvUpiMsg.text = context.getString(R.string.upto1LakhOnly) | |||||
}else{ | |||||
holder.tvUpiMsg.text = "" | |||||
} | |||||
if (selectedAccount == bankList.Value && checkedPosition == -2 | |||||
) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
checkedPosition = holder.adapterPosition | |||||
} else if (checkedPosition == -1) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_outline) | |||||
} else if (checkedPosition == holder.adapterPosition) { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
} else { | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_outline) | |||||
} | |||||
setOnClickListener { | |||||
onItemClickListener?.let { | |||||
it(bankList) | |||||
holder.bankSelector.setBackgroundResource(R.drawable.ic_select_green) | |||||
if (checkedPosition != holder.adapterPosition) { | |||||
notifyItemChanged(checkedPosition) | |||||
checkedPosition = holder.adapterPosition | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
override fun getItemCount(): Int { | |||||
return bankList?.size!! | |||||
} | |||||
private var onItemClickListener: ((GetCodes) -> Unit)? = null | |||||
fun setOnItemClickListener(listener: (GetCodes) -> Unit) { | |||||
onItemClickListener = listener | |||||
} | |||||
fun getSelected(): GetCodes? { | |||||
return if (checkedPosition != -1) { | |||||
bankList?.get(checkedPosition) | |||||
} else null | |||||
} | |||||
} |
@ -0,0 +1,39 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import android.widget.TextView | |||||
import androidx.recyclerview.widget.RecyclerView | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.model.Bank | |||||
class RecommendedBankListAdapter( | |||||
private val bankList: List<Bank> | |||||
) : RecyclerView.Adapter<RecommendedBankListAdapter.MyViewHolder>() { | |||||
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |||||
val txtYear: TextView | |||||
init { | |||||
txtYear = view.findViewById(R.id.txtYear) | |||||
} | |||||
} | |||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { | |||||
val itemView: View = LayoutInflater.from(parent.context) | |||||
.inflate(R.layout.row_bank_list, parent, false) | |||||
return MyViewHolder(itemView) | |||||
} | |||||
override fun onBindViewHolder(holder: MyViewHolder, position: Int) { | |||||
val bank: Bank = bankList[position] | |||||
holder.txtYear.text = bank.BankName | |||||
} | |||||
override fun getItemCount(): Int { | |||||
return bankList.size | |||||
} | |||||
} |
@ -0,0 +1,18 @@ | |||||
package com.nivesh.production.bajajfd.adapter | |||||
import androidx.fragment.app.Fragment | |||||
import androidx.fragment.app.FragmentManager | |||||
import androidx.fragment.app.FragmentPagerAdapter | |||||
class SectionsPagerAdapter(manager: FragmentManager,private val fragments: Array<Fragment>) : FragmentPagerAdapter(manager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { | |||||
private val titles = ArrayList<String>() | |||||
override fun getItem(position: Int): Fragment = fragments[position] | |||||
override fun getCount(): Int = fragments.size | |||||
override fun getPageTitle(position: Int): CharSequence = titles[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,65 @@ | |||||
package com.nivesh.production.bajajfd.api | |||||
import com.nivesh.production.bajajfd.BajajApplication | |||||
import com.nivesh.production.bajajfd.interfaces.ApiInterface | |||||
import com.nivesh.production.bajajfd.util.Constants.Companion.BASE_URL | |||||
import okhttp3.OkHttpClient | |||||
import okhttp3.logging.HttpLoggingInterceptor | |||||
import retrofit2.Retrofit | |||||
import retrofit2.converter.gson.GsonConverterFactory | |||||
import java.security.KeyStore | |||||
import java.util.* | |||||
import java.util.concurrent.TimeUnit | |||||
import javax.net.ssl.* | |||||
class ApiClient { | |||||
val context = BajajApplication.appContext | |||||
companion object { | |||||
private val client by lazy { | |||||
//lazy means we only initialize this here once | |||||
val logging = HttpLoggingInterceptor() | |||||
//loggingInterceptor use for see making request and for see what responses are | |||||
logging.setLevel(HttpLoggingInterceptor.Level.BODY) | |||||
//see the body of response | |||||
//create client for retrofit | |||||
val trustManagerFactory: TrustManagerFactory = | |||||
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()) | |||||
trustManagerFactory.init(null as KeyStore?) | |||||
val trustManagers: Array<TrustManager> = trustManagerFactory.getTrustManagers() | |||||
check(!(trustManagers.size != 1 || trustManagers[0] !is X509TrustManager)) { | |||||
"Unexpected default trust managers:" + Arrays.toString( | |||||
trustManagers | |||||
) | |||||
} | |||||
val trustManager: X509TrustManager = trustManagers[0] as X509TrustManager | |||||
val sslContext = SSLContext.getInstance("SSL") | |||||
sslContext.init(null, arrayOf(trustManager), null) | |||||
val sslSocketFactory: SSLSocketFactory = sslContext.socketFactory | |||||
val client = OkHttpClient.Builder() | |||||
.addInterceptor(logging) | |||||
.sslSocketFactory(sslSocketFactory, trustManager) | |||||
.retryOnConnectionFailure(true) | |||||
.callTimeout(2, TimeUnit.MINUTES) | |||||
.connectTimeout(20, TimeUnit.SECONDS) | |||||
.readTimeout(30, TimeUnit.SECONDS) | |||||
.writeTimeout(30, TimeUnit.SECONDS) | |||||
.build() | |||||
Retrofit.Builder() | |||||
.baseUrl(BASE_URL) | |||||
.addConverterFactory(GsonConverterFactory.create()) | |||||
.client(client) | |||||
.build() | |||||
} | |||||
val getApiClient: ApiInterface by lazy { | |||||
client.create(ApiInterface::class.java) | |||||
} | |||||
} | |||||
} | |||||
@ -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(); | |||||
// | |||||
// | |||||
// } | |||||
} |
@ -0,0 +1,180 @@ | |||||
package com.nivesh.production.bajajfd.interfaces | |||||
import com.google.gson.JsonObject | |||||
import com.nivesh.production.bajajfd.model.* | |||||
import okhttp3.RequestBody | |||||
import retrofit2.Response | |||||
import retrofit2.http.* | |||||
interface ApiInterface { | |||||
@POST("GetRates") | |||||
suspend fun getRates( | |||||
@Body getRatesRequest: GetRatesRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("CheckFDCKYC") | |||||
suspend fun checkFDKYC( | |||||
@Body checkFDKYCRequest: CheckFDKYCRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("CreateFDApplication") | |||||
suspend fun createFDApp( | |||||
@Body createFDRequest: CreateFDRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("DocumentsUpload") | |||||
suspend fun documentsUpload( | |||||
@Body requestBody: DocumentUpload, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("SaveFDOtherData") | |||||
suspend fun saveFDOtherData( | |||||
@Body requestBody: SaveFDOtherDataRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetFDDetails") | |||||
suspend fun getFDDetails( | |||||
@Body requestBody: GetFDDetailsRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("UpdateFDPaymentStatus") | |||||
suspend fun updateFDPaymentStatus( | |||||
@Body requestBody: RequestBody, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("FinaliseFD") | |||||
suspend fun finaliseFD( | |||||
@Body requestBody: FinalizeFDRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("FinaliseKYC") | |||||
suspend fun finaliseKYC( | |||||
@Body requestBody: FinalizeKYCRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("PaymentRequery") | |||||
suspend fun paymentReQuery( | |||||
@Body requestBody: PaymentReQueryRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
// @FormUrlEncoded | |||||
@POST("GetCodes") | |||||
suspend fun getCodes( | |||||
@Body requestBody: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("CalculateFDMaturityAmount") | |||||
suspend fun getCalculateFDMaturityAmount( | |||||
@Body requestBody: GetMaturityAmountRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("PanCheck_S") | |||||
suspend fun panCheckApi( | |||||
@Body panCheck: PanCheckRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("getFDStepsCount") | |||||
suspend fun getFDStepsCount( | |||||
@Body fdStepsCountRequest: FDStepsCountRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetClientDetailV2_S") | |||||
suspend fun getClientDetails( | |||||
@Body getClientDetailsRequest: getClientDetailsRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun titleApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun genderApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun annualIncomeApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun relationShipApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun maritalStatusApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun occupationApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetStateMaster") | |||||
suspend fun stateApi(@Header("token") token: String): Response<JsonObject> | |||||
@POST("GetCity") | |||||
suspend fun cityApi( | |||||
@Body cityRequest: CityRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@GET("GetFDBankList?FDProvider=Bajaj") | |||||
suspend fun bankListApi(@Header("token") token: String, @Query("Language") language : String): Response<JsonObject> | |||||
@GET("GetIFSC_Autofill?") | |||||
suspend fun getIFSCApi(@Query("prefix") ifsc : String): Response<JsonObject> | |||||
@GET("GetbankNames") | |||||
suspend fun getIFSCBankDetailsApi(@Query( "bankname") ifsc : String, @Header("token") token: String): Response<String> | |||||
@POST("GetCodes") | |||||
suspend fun payModeApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetCodes") | |||||
suspend fun customerListApi( | |||||
@Body getCodeRequest: GetCodeRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("BankValidationAPI_S") | |||||
suspend fun bankValidationApi( | |||||
@Body bankValidationApiRequest: BankValidationApiRequest, | |||||
@Header("token") token: String | |||||
): Response<JsonObject> | |||||
@POST("GetToken_V2") | |||||
suspend fun freshToken( | |||||
@Body requestBody: RequestBody | |||||
):Response<JsonObject> | |||||
} |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.interfaces; | |||||
public interface OnClickListener { | |||||
void onclickCategory(int position); | |||||
} |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.interfaces | |||||
import com.nivesh.production.bajajfd.model.CreateFDApplicationResponse | |||||
interface SendData { | |||||
fun sendDataFragment(message: CreateFDApplicationResponse) | |||||
fun sendDataFragmentStepFour(message: CreateFDApplicationResponse) | |||||
} |
@ -0,0 +1,24 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ApplicantDetails( | |||||
var AnnualIncome: String?= null, | |||||
var ApplicantAddress1: String?= null, | |||||
var ApplicantAddress2: String?= null, | |||||
var ApplicantAddress3: String?= null, | |||||
var ApplicantCity: String?= null, | |||||
var ApplicantCountry: String?= null, | |||||
var ApplicantDOB: String?= null, | |||||
var ApplicantEmail: String?= null, | |||||
var ApplicantFirstName: String?= null, | |||||
var ApplicantGender: String?= null, | |||||
var ApplicantLastName: String?= null, | |||||
var ApplicantMaritalStatus: String?= null, | |||||
var ApplicantMiddleName: String?= null, | |||||
var ApplicantMobile: String?= null, | |||||
var ApplicantOccupation: String?= null, | |||||
var ApplicantPAN: String?= null, | |||||
var ApplicantPincode: Int?= 0, | |||||
var ApplicantQualification: String?= null, | |||||
var ApplicantSalutation: String?= null, | |||||
var ApplicantState: String?= null | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ApplicantRelationDetails( | |||||
var ApplicantMotherFirstName: String? = null, | |||||
var ApplicantMotherLastName: String? = null, | |||||
var ApplicantRelation: String? = null, | |||||
var ApplicantRelationFirstName: String? = null, | |||||
var ApplicantRelationLastName: String? = null, | |||||
var ApplicantRelationSalutation: String? = null | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class Bank( | |||||
val BankName: String, | |||||
val IFSC4Mapping: String | |||||
) |
@ -0,0 +1,15 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
import java.io.Serializable | |||||
data class BankList( | |||||
val BankName: String?, | |||||
val IFSCCode: String?, | |||||
val AccountNumber: String?, | |||||
val BranchName: String?, | |||||
val DefaultBankFlag: String?, | |||||
val IsValBank: String?, | |||||
val AccountType: String? | |||||
): Serializable | |||||
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class BankValidationApiRequest( | |||||
var BankAccountNo: String?="", | |||||
var BankNo: Int?= 0, | |||||
var IFSC: String?= "", | |||||
var Name: String? = "", | |||||
var PhoneNo: String? = "", | |||||
var RoleId: Int? = 0 | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class BankValidationApiResponse( | |||||
val DataObject: Any, | |||||
val Message: String, | |||||
val ObjectResponse: Any, | |||||
val response: ResponseXXXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CheckFDKYCRequest( | |||||
var DOB: String? ="", | |||||
var Mobile: String? = "", | |||||
var NiveshClientCode: String? = "", | |||||
var PAN: String?= "" | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CityListResponse( | |||||
val DataObject: List<DataObjectX>, | |||||
val response: ResponseXXXXXX | |||||
) |
@ -0,0 +1,15 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CityRequest( | |||||
var APIName: String? = "", | |||||
var APP_Web: String?="", | |||||
var ClientCode: String?="", | |||||
var HOCode: String?="", | |||||
var RMCode: String?="", | |||||
var RoleID: Int = 0, | |||||
var Source: String? = "", | |||||
var StateCode: Int? = 0, | |||||
var Subbroker_Code: String? = "", | |||||
var Type: String?= "", | |||||
var UID: Int = 0 | |||||
) |
@ -0,0 +1,11 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ClientBanklist( | |||||
var AccountNumber: String?="", | |||||
var AccountType: String?="", | |||||
var BankName: String?="", | |||||
var BranchName: String?="", | |||||
val DefaultBankFlag: String?="", | |||||
var IFSCCode: String?="", | |||||
var IsValBank: Int? = 0 | |||||
) |
@ -0,0 +1,22 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ClientDetails( | |||||
val ARNexpiredFlag: Boolean, | |||||
val EditProfileMessage: String, | |||||
val IsPartiallyFilled: Boolean, | |||||
val KYCstatus: String, | |||||
val ProfileMessage: String, | |||||
val ProfileStatus: String, | |||||
val UnifiedMessage: String, | |||||
val appliaction1_image_name: String, | |||||
val city_of_birth: String, | |||||
val clientMasterMFD: ClientMasterMFD, | |||||
val country_of_birth: String, | |||||
val created_by: String, | |||||
val created_date: String, | |||||
val email: String, | |||||
val mobile: String, | |||||
val modified_by: String, | |||||
val modified_date: String, | |||||
val sub_broker_code: String | |||||
) |
@ -0,0 +1,40 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ClientMasterMFD( | |||||
val CLIENT_ACCNO1: String, | |||||
val CLIENT_ACCTYPE1: String, | |||||
val CLIENT_ADD1: String, | |||||
val CLIENT_ADD2: String, | |||||
val CLIENT_ADD3: String, | |||||
val CLIENT_APPNAME1: String, | |||||
val CLIENT_CITY: String, | |||||
val CLIENT_CODE: String, | |||||
val CLIENT_COMMMODE: String, | |||||
val CLIENT_COUNTRY: String, | |||||
val CLIENT_DIVPAYMODE: String, | |||||
val CLIENT_DOB: String, | |||||
val CLIENT_EMAIL: String, | |||||
val CLIENT_FATHER_HUSBAND_GUARDIAN: String, | |||||
val CLIENT_GENDER: String, | |||||
val CLIENT_GUARDIANPAN: String, | |||||
val CLIENT_HOLDING: String, | |||||
val CLIENT_NEFT_IFSCCODE1: String, | |||||
val CLIENT_OCCUPATION_CODE: String, | |||||
val CLIENT_PAN: String, | |||||
val CLIENT_PINCODE: String, | |||||
val CLIENT_STATE: String, | |||||
val CLIENT_TAXSTATUS: String, | |||||
val CLIENT_TYPE: String, | |||||
val CM_MOBILE: String, | |||||
val Client_Title: String, | |||||
val DEFAULT_BLANK_FLAG1: String, | |||||
val Filler1: String, | |||||
val Filler2: String, | |||||
val Filler3: Any, | |||||
val NominationAuthMode: String, | |||||
val NominationOptFlag: String, | |||||
val Nominee_Title: String, | |||||
val Nominees: List<Nominee>, | |||||
val ParentName: String, | |||||
val ums_id: String | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CreateFDApplicationRequest( | |||||
var ApplicantDetails: ApplicantDetails ? = null, | |||||
var ApplicantRelationDetails: ApplicantRelationDetails? = null, | |||||
var FDInvestmentDetails: FDInvestmentDetails? = null, | |||||
var FdBankDetails: FdBankDetails? = null, | |||||
var NomineeDetails: NomineeDetails? = null, | |||||
var NomineeGuardianDetails: NomineeGuardianDetails ? = null | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CreateFDApplicationResponse( | |||||
val Response: ResponseXXXXXXXXXXX | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class CreateFDRequest( | |||||
var CreateFDApplicationRequest: CreateFDApplicationRequest? = null | |||||
) |
@ -0,0 +1,17 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
import java.io.Serializable | |||||
data class DataObject( | |||||
var BSE_State_Code: String? = "", | |||||
var CAMS_statecode: String? = "", | |||||
var Country_Id: Int? = 0, | |||||
var State_Code: String?= "", | |||||
var State_Id: Int? = 0, | |||||
var State_Name: String? = "", | |||||
var signzyCode: String? = "" | |||||
): Serializable { | |||||
override fun toString(): String { | |||||
return State_Name.toString() | |||||
} | |||||
} |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class DataObjectX( | |||||
val city_id: Int, | |||||
val city_name: String | |||||
) { | |||||
override fun toString(): String { | |||||
return city_name | |||||
} | |||||
} |
@ -0,0 +1,12 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class DeviceInfo( | |||||
var app_version: String? = "", | |||||
var device_id: String? = "", | |||||
var device_model: String? = "", | |||||
var device_name: String? ="", | |||||
var device_os_version: String? = "", | |||||
var device_token: String? = "", | |||||
var device_type: String? = "", | |||||
var device_id_for_UMSId : String? = "" | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class DocumentUpload( | |||||
var Description: String? = null, | |||||
var DocumentType: String? = null, | |||||
var FDProvider: String? = null, | |||||
var ImageEncodeToBase64: String? = null, | |||||
var NiveshClientCode: String? = null, | |||||
var UniqueId: String? = null | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class Errors( | |||||
val ErrorCode: Int, | |||||
val ErrorMessage: String | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FDCreationDetailsResponse( | |||||
val DocumentUploadFlag: Int, | |||||
val UniqueId: String, | |||||
val kycFlag: Int | |||||
) |
@ -0,0 +1,12 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FDDataResponse( | |||||
val FDAmount: Double, | |||||
val Frequency: String, | |||||
val ParameterName: String, | |||||
val PaymentUrl: String, | |||||
val RateOfInterest: Double, | |||||
val Tenure: Int, | |||||
val UniqueId: String, | |||||
val Value: String | |||||
) |
@ -0,0 +1,18 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FDInvestmentDetails( | |||||
var CKYCNumber: String? = null, | |||||
var CitizenType: String? = null, | |||||
var CustomerType: String? = null, | |||||
var Device: String? = null, | |||||
var FDAmount: Double? = 0.0, | |||||
var Frequency: String? = null, | |||||
var IPAddress: String? = null, | |||||
var Interest: Double? = 0.0, | |||||
var NiveshClientCode: String? = null, | |||||
var Provider: String? = null, | |||||
var Source: String? = null, | |||||
var Tenure: Int? = 0, | |||||
var UniqueId: String? = "" | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FDStepsCountRequest( | |||||
var FDProvider: String? = "", | |||||
var NiveshClientCode: String? = "" | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FdBankDetails( | |||||
var AccountNumber: String?= null, | |||||
var AccountType: String?= null, | |||||
var BankBranch: String?= null, | |||||
var BankName: String?= null, | |||||
var IFSCCode: String?= null, | |||||
var PaymentMode: String?= null | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FinaliseFD( | |||||
var FDProvider: String? = "", | |||||
var NiveshClientCode: String? = "", | |||||
var UniqueId: String? = "" | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FinalizeFDRequest( | |||||
var FinaliseFD: FinaliseFD? = null | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FinalizeFDResponse( | |||||
val Response: ResponseXXXXXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class FinalizeKYCRequest( | |||||
var FDProvider: String? = "", | |||||
var NiveshClientCode: String? = "", | |||||
var UniqueId: String? = "" | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetCalculateMaturityAmountResponse( | |||||
val Response: ResponseXX | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetCodeRequest( | |||||
var Category: String ? = null, | |||||
var InputValue: String? = null, | |||||
var Language: String ? = null, | |||||
var ProductName: String? = null | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetCodeResponse( | |||||
val Response: ResponseX | |||||
) |
@ -0,0 +1,11 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetCodes( | |||||
val Label: String, | |||||
var Value: String, | |||||
var isSelected : Boolean | |||||
) { | |||||
override fun toString(): String { | |||||
return Label | |||||
} | |||||
} |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetFDBankListResponse( | |||||
val Response: ResponseXXXXXXXX | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetFDDetailsRequest( | |||||
var FDProvider: String? = "", | |||||
var NiveshClientCode: String? = "", | |||||
var UniqueId: String? = "" | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetFDDetailsResponse( | |||||
val Response: ResponseXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetIFSCCodeListResponse( | |||||
val IFSCCodes: MutableList<String>, | |||||
val Response: ResponseXXXXXXXXXX | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetIFSCCodeResponse( | |||||
val IFSCCODEServiceResult: List<IFSCCODEServiceResult> | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class GetMaturityAmountRequest( | |||||
var FDAmount: Int? = 0, | |||||
var FDProvider: String? = "", | |||||
var Frequency: String? = "", | |||||
var Interest: Double? = 0.0, | |||||
var Tenure: Int? = 0 | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
import com.google.gson.annotations.SerializedName | |||||
data class GetRatesRequest( | |||||
@SerializedName("FDProvider") var fdProvider: String? = null, | |||||
@SerializedName("Frequency") var frequency: String? = null, | |||||
@SerializedName("Type") var type: String? = null | |||||
) |
@ -0,0 +1,3 @@ | |||||
data class GetRatesResponse( | |||||
val Response: Response | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class IFSCCODEServiceResult( | |||||
val BankBranch: String, | |||||
val BnkDescr: String, | |||||
val BnkShrtDescr: String, | |||||
val Code: String, | |||||
val IfscCode: String, | |||||
val intCustbnk_pk: String | |||||
) |
@ -0,0 +1,12 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class Nominee( | |||||
val NomineeApplicablePercent: Double, | |||||
val NomineeDOB: String, | |||||
val NomineeGuardian: String, | |||||
val NomineeGuardianPAN: String, | |||||
val NomineeMinorFlag: String, | |||||
val NomineeName: String, | |||||
val NomineePAN: String, | |||||
val NomineeRelationship: String | |||||
) |
@ -0,0 +1,18 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class NomineeDetails( | |||||
var NomineeAddress1: String?= null, | |||||
var NomineeAddress2: String?= null, | |||||
var NomineeAddress3: String?= null, | |||||
var NomineeCity: String?= null, | |||||
var NomineeCountry: String?= null, | |||||
var NomineeDOB: String?= null, | |||||
var NomineeFirstName: String?= null, | |||||
var NomineeGender: String?= null, | |||||
var NomineeLastName: String?= null, | |||||
var NomineeMiddleName: String?= null, | |||||
var NomineePincode: Int?= 0, | |||||
var NomineeRelation: String?= null, | |||||
var NomineeSalutation: String?= null, | |||||
var NomineeState: String?= null | |||||
) |
@ -0,0 +1,14 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class NomineeGuardianDetails( | |||||
var GuardianAddress1: String?= null, | |||||
var GuardianAddress2: String?= null, | |||||
var GuardianAddress3: String?= null, | |||||
var GuardianAge: Int?= 0, | |||||
var GuardianCity: String?= null, | |||||
var GuardianCountry: String?= null, | |||||
var GuardianName: String?= null, | |||||
var GuardianPincode: Int?= 0, | |||||
var GuardianSalutation: String?= null, | |||||
var GuardianState: String?= null | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ObjectResponse( | |||||
val TransactionCount: Int, | |||||
val clientDetails: ClientDetails, | |||||
val languageid: Int, | |||||
val membersList: List<Any>, | |||||
val ClientBanklist : List<ClientBanklist> | |||||
) |
@ -0,0 +1,14 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
import com.google.gson.annotations.SerializedName | |||||
data class PanCheckRequest( | |||||
@SerializedName("client_code") | |||||
var clientCode: String? = null, | |||||
@SerializedName("sub_broker_code") | |||||
var subBrokerCode: String? = null, | |||||
@SerializedName("pan_number") | |||||
var panNumber: String? = null, | |||||
@SerializedName("mobile_number") | |||||
var mobileNumber: String? = null | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class PanCheckResponse( | |||||
val response: ResponseXXX | |||||
) |
@ -0,0 +1,6 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class PaymentReQueryRequest( | |||||
var NiveshClientCode: String? = "", | |||||
var UniqueId: String? = "" | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class PaymentReQueryResponse( | |||||
val Response: ResponseXXXXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,11 @@ | |||||
data class ROIDataList( | |||||
val Frequency: String, | |||||
val Provider: String, | |||||
val ROI: Double, | |||||
val Tenure: String, | |||||
val Type: String | |||||
) { | |||||
override fun toString(): String { | |||||
return Tenure.plus(" Months ").plus(" | ").plus(ROI).plus("%") | |||||
} | |||||
} |
@ -0,0 +1,9 @@ | |||||
import com.nivesh.production.bajajfd.model.Errors | |||||
data class Response( | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
var ROIDatalist: MutableList<ROIDataList>, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseX( | |||||
val Errors: List<Errors>, | |||||
val GetCodesList: MutableList<GetCodes>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXX( | |||||
val Errors: List<Errors>, | |||||
val MaturityAmount: Double, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXX( | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int, | |||||
val StepsCount: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXX( | |||||
val BankList: List<Bank>, | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXXX( | |||||
val Errors: List<Errors>, | |||||
val FDCreationDetailsResponse: FDCreationDetailsResponse, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,11 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
import com.nivesh.production.bajajfd.util.Resource | |||||
data class ResponseXXXXXXXXXXXX( | |||||
val Errors: List<Errors>, | |||||
val FDDataResponse: FDDataResponse, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -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,7 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXXXXXX( | |||||
val message: String, | |||||
val status: String, | |||||
val status_code: Int | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXXXXXXX( | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int | |||||
) |
@ -0,0 +1,9 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class ResponseXXXXXXXXXXXXXXXX( | |||||
val Errors: List<Errors>, | |||||
val Message: String, | |||||
val Status: String, | |||||
val StatusCode: Int, | |||||
val UniqueId: String | |||||
) |
@ -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,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class StateListResponse( | |||||
val DataObject: List<DataObject>, | |||||
val Message: Any, | |||||
val ObjectResponse: Any, | |||||
val response: ResponseXXXXX | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class StepsCountResponse( | |||||
val Response: ResponseXXXX | |||||
) |
@ -0,0 +1,5 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class UploadResponse( | |||||
val Response: ResponseXXXXXXXXXXXX | |||||
) |
@ -0,0 +1,10 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class UserRequest( | |||||
var AppOrWeb: String? = "", | |||||
var IPAddress: String? = "", | |||||
var LoggedInRoleId: Int = 0, | |||||
var Source: String? = "", | |||||
var UID: Int? = 0, | |||||
var deviceInfo: DeviceInfo? = null | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class getClientDetailsRequest( | |||||
var AppOrWeb: String? = "", | |||||
var UserRequest: UserRequest? = null, | |||||
var client_code: String? = "", | |||||
var sub_broker_code: String? = "" | |||||
) |
@ -0,0 +1,8 @@ | |||||
package com.nivesh.production.bajajfd.model | |||||
data class getClientDetailsResponse( | |||||
// val DataObject: Any ?, | |||||
// val Message: Any, | |||||
val ObjectResponse: ObjectResponse? = null, | |||||
val response: ResponseXXXXXXX? = null | |||||
) |
@ -0,0 +1,110 @@ | |||||
package com.nivesh.production.bajajfd.repositories | |||||
import com.nivesh.production.bajajfd.interfaces.ApiInterface | |||||
import com.nivesh.production.bajajfd.model.* | |||||
class MainRepository constructor(private val apiInterface: ApiInterface) { | |||||
// MainActivity | |||||
suspend fun getStepsCountResponse(requestBody: FDStepsCountRequest, token: String) = | |||||
apiInterface.getFDStepsCount(requestBody, token) | |||||
suspend fun getClientDetailsResponse(getClientDetails: getClientDetailsRequest, token: String) = | |||||
apiInterface.getClientDetails(getClientDetails, token) | |||||
// Step One | |||||
suspend fun getRatesResponse(getRatesRequest: GetRatesRequest, token: String) = | |||||
apiInterface.getRates(getRatesRequest, token) | |||||
suspend fun getCodesResponse(requestBody: GetCodeRequest, token: String) = | |||||
apiInterface.getCodes(requestBody, token) | |||||
suspend fun createCalculateFDMaturityAmount( | |||||
requestBody: GetMaturityAmountRequest, | |||||
token: String | |||||
) = | |||||
apiInterface.getCalculateFDMaturityAmount(requestBody, token) | |||||
// Step Two | |||||
suspend fun createFDKYCResponse(createFDRequest: CreateFDRequest, token: String) = | |||||
apiInterface.createFDApp(createFDRequest, token) | |||||
suspend fun panCheck(panCheck: PanCheckRequest, token: String) = | |||||
apiInterface.panCheckApi(panCheck, token) | |||||
suspend fun titleCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.titleApi(getCodeRequest, token) | |||||
suspend fun genderCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.genderApi(getCodeRequest, token) | |||||
suspend fun annualIncomeCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.annualIncomeApi(getCodeRequest, token) | |||||
suspend fun relationShipCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.relationShipApi(getCodeRequest, token) | |||||
suspend fun maritalStatusCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.maritalStatusApi(getCodeRequest, token) | |||||
suspend fun occupationCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.occupationApi(getCodeRequest, token) | |||||
suspend fun stateCheck(token: String) = | |||||
apiInterface.stateApi(token) | |||||
suspend fun cityCheck(cityRequest: CityRequest, token: String) = | |||||
apiInterface.cityApi(cityRequest, token) | |||||
suspend fun bankListCheck(token: String, language: String) = | |||||
apiInterface.bankListApi(token, language) | |||||
suspend fun ifscCodeCheck(str: String) = | |||||
apiInterface.getIFSCApi(str) | |||||
suspend fun ifscCodeBankDetailsCheck(str: String, token: String) = | |||||
apiInterface.getIFSCBankDetailsApi(str, token) | |||||
suspend fun payModeCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.payModeApi(getCodeRequest, token) | |||||
suspend fun bankValidationApiRequest(bankValidationApiRequest: BankValidationApiRequest, token: String) = | |||||
apiInterface.bankValidationApi(bankValidationApiRequest, token) | |||||
// Step Three | |||||
suspend fun documentsUploadResponse(getRatesRequest: DocumentUpload, token: String) = | |||||
apiInterface.documentsUpload(getRatesRequest, token) | |||||
suspend fun saveFDOtherDataResponse(getRatesRequest: SaveFDOtherDataRequest, token: String) = | |||||
apiInterface.saveFDOtherData(getRatesRequest, token) | |||||
suspend fun getFDDetailsResponse(getRatesRequest: GetFDDetailsRequest, token: String) = | |||||
apiInterface.getFDDetails(getRatesRequest, token) | |||||
suspend fun updateFDPaymentStatusResponse(getRatesRequest: GetRatesRequest, token: String) = | |||||
apiInterface.getRates(getRatesRequest, token) | |||||
// Step 4 | |||||
suspend fun customerListCheck(getCodeRequest: GetCodeRequest, token: String) = | |||||
apiInterface.customerListApi(getCodeRequest, token) | |||||
suspend fun checkFDKYCRequest(checkFDKYCRequest: CheckFDKYCRequest, token: String) = | |||||
apiInterface.checkFDKYC(checkFDKYCRequest, token) | |||||
// Step 5 | |||||
suspend fun finaliseFDResponse(getRatesRequest: FinalizeFDRequest, token: String) = | |||||
apiInterface.finaliseFD(getRatesRequest, token) | |||||
suspend fun finaliseKYCResponse(getRatesRequest: FinalizeKYCRequest, token: String) = | |||||
apiInterface.finaliseKYC(getRatesRequest, token) | |||||
suspend fun paymentReQueryResponse(getRatesRequest: PaymentReQueryRequest, token: String) = | |||||
apiInterface.paymentReQuery(getRatesRequest, token) | |||||
} |
@ -0,0 +1,489 @@ | |||||
package com.nivesh.production.bajajfd.ui.activity | |||||
import android.annotation.SuppressLint | |||||
import android.app.Dialog | |||||
import android.graphics.Bitmap | |||||
import android.graphics.drawable.Drawable | |||||
import android.os.Bundle | |||||
import android.util.Log | |||||
import android.view.View | |||||
import android.view.WindowManager | |||||
import android.webkit.WebView | |||||
import android.webkit.WebViewClient | |||||
import android.widget.TextView | |||||
import androidx.fragment.app.Fragment | |||||
import androidx.lifecycle.ViewModelProvider | |||||
import androidx.viewpager.widget.ViewPager | |||||
import com.google.gson.Gson | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.adapter.DisableAdapter | |||||
import com.nivesh.production.bajajfd.adapter.SectionsPagerAdapter | |||||
import com.nivesh.production.bajajfd.api.ApiClient | |||||
import com.nivesh.production.bajajfd.databinding.ActivityBajajFdBinding | |||||
import com.nivesh.production.bajajfd.model.* | |||||
import com.nivesh.production.bajajfd.repositories.MainRepository | |||||
import com.nivesh.production.bajajfd.ui.fragment.* | |||||
import com.nivesh.production.bajajfd.ui.providerfactory.* | |||||
import com.nivesh.production.bajajfd.util.Common | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.defaultShape | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.getDate | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.selectedShape | |||||
import com.nivesh.production.bajajfd.util.Common.Companion.showDialogValidation | |||||
import com.nivesh.production.bajajfd.util.Constants.Companion.token | |||||
import com.nivesh.production.bajajfd.util.ProgressUtil | |||||
import com.nivesh.production.bajajfd.util.ProgressUtil.hideLoading | |||||
import com.nivesh.production.bajajfd.util.ProgressUtil.showLoading | |||||
import com.nivesh.production.bajajfd.util.Resource | |||||
import com.nivesh.production.bajajfd.viewModel.* | |||||
class BajajFdMainActivity : BaseActivity() { | |||||
lateinit var binding: ActivityBajajFdBinding | |||||
lateinit var viewModel: BajajFDViewModel | |||||
private val stepOneBajajFDFragment = StepOneBajajFDFragment() | |||||
private val stepTwoBajajFDFragment = StepTwoBajajFDFragment() | |||||
private val stepThreeBajajFDFragment = StepThreeBajajFDFragment() | |||||
private val stepFourBajajFDFragment = StepFourBajajFDFragment() | |||||
private val stepFiveBajajFDFragment = StepFiveBajajFDFragment() | |||||
var createFDRequest: CreateFDRequest = CreateFDRequest() | |||||
var createFDApplicantRequest: CreateFDApplicationRequest = CreateFDApplicationRequest() | |||||
var applicantDetails: ApplicantDetails = ApplicantDetails() | |||||
var fdInvestmentDetails: FDInvestmentDetails = FDInvestmentDetails() | |||||
var applicantRelationDetails: ApplicantRelationDetails = ApplicantRelationDetails() | |||||
var fdBankDetails: FdBankDetails = FdBankDetails() | |||||
var nomineeDetails: NomineeDetails = NomineeDetails() | |||||
var nomineeGuardianDetails: NomineeGuardianDetails = NomineeGuardianDetails() | |||||
var getClientDetailsResponse: getClientDetailsResponse = getClientDetailsResponse() | |||||
var uniqueId: String = "" | |||||
var stepCount: Int = 0 | |||||
private lateinit var sectionsPagerAdapter: SectionsPagerAdapter | |||||
private lateinit var fragments: Array<Fragment> | |||||
var dialogWebView: Dialog? = null | |||||
var loginRole: Int = 0 | |||||
override fun onCreate(savedInstanceState: Bundle?) { | |||||
super.onCreate(savedInstanceState) | |||||
init() | |||||
} | |||||
private fun init() { | |||||
//start Repository | |||||
viewModel = ViewModelProvider( | |||||
this@BajajFdMainActivity, | |||||
FDModelProviderFactory(MainRepository(ApiClient.getApiClient)) | |||||
)[BajajFDViewModel::class.java] | |||||
binding = ActivityBajajFdBinding.inflate(layoutInflater) | |||||
binding.apply { | |||||
setContentView(this.root) | |||||
} | |||||
loginRole = 5 | |||||
if (Common.isNetworkAvailable(this)) { | |||||
getStepsCountApi() | |||||
} | |||||
binding.imgBack.setOnClickListener { | |||||
finish() | |||||
} | |||||
} | |||||
private fun getStepsCountApi() { | |||||
if (Common.isNetworkAvailable(this)) { | |||||
val fdStepsCount = FDStepsCountRequest() | |||||
fdStepsCount.FDProvider = getString(R.string.bajaj) | |||||
fdStepsCount.NiveshClientCode = "8872" // 60476 | |||||
viewModel.getStepsCount(fdStepsCount, token, this) | |||||
viewModel.getStepsCountMutableData.observe(this) { response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("response", "-->${response.data.toString()}") | |||||
val stepsCountResponse: StepsCountResponse = | |||||
Gson().fromJson( | |||||
response.data?.toString(), | |||||
StepsCountResponse::class.java | |||||
) | |||||
stepsCountResponse.Response.StatusCode.let { code -> | |||||
when (code) { | |||||
200 -> { | |||||
stepCount = stepsCountResponse.Response.StepsCount | |||||
if (stepCount == 3) { | |||||
binding.llStep4.visibility = View.GONE | |||||
} | |||||
getClientDetailsApi(stepsCountResponse.Response.StepsCount) | |||||
} | |||||
650 -> "" | |||||
else -> { | |||||
showDialogValidation( | |||||
this@BajajFdMainActivity, | |||||
stepsCountResponse.Response.Errors[0].ErrorMessage | |||||
) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
showDialogValidation(this@BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
private fun getClientDetailsApi(stepsCount: Int) { | |||||
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { | |||||
val getClientDetailsRequest = getClientDetailsRequest() | |||||
getClientDetailsRequest.client_code = "8872" | |||||
getClientDetailsRequest.AppOrWeb = getString(R.string.app) | |||||
getClientDetailsRequest.sub_broker_code = "1038" | |||||
val userRequest = UserRequest() | |||||
userRequest.UID = 0 | |||||
userRequest.IPAddress = "" | |||||
userRequest.Source = getString(R.string.source) | |||||
userRequest.AppOrWeb = getString(R.string.app) | |||||
userRequest.LoggedInRoleId = loginRole | |||||
val deviceInfo = DeviceInfo() | |||||
deviceInfo.device_id = "" | |||||
deviceInfo.device_id_for_UMSId = "" | |||||
deviceInfo.device_type = getString(R.string.app) | |||||
deviceInfo.device_model = "" | |||||
deviceInfo.device_token = "" | |||||
deviceInfo.device_name = "" | |||||
deviceInfo.app_version = "" | |||||
deviceInfo.device_os_version = "" | |||||
userRequest.deviceInfo = deviceInfo | |||||
getClientDetailsRequest.UserRequest = userRequest | |||||
Log.e("getClientDetail ", " Request -->" + Gson().toJson(getClientDetailsRequest)) | |||||
showLoading(this@BajajFdMainActivity) | |||||
viewModel.getClientDetails(getClientDetailsRequest, token, this) | |||||
viewModel.getClientDetailsMutableData.observe(this) { response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("getClientDetail ", " response -->${response.data.toString()}") | |||||
getClientDetailsResponse = | |||||
Gson().fromJson( | |||||
response.data?.toString(), | |||||
getClientDetailsResponse::class.java | |||||
) | |||||
getClientDetailsResponse.response?.status_code.let { code -> | |||||
when (code) { | |||||
200 -> { | |||||
setViewPager(stepsCount) | |||||
checkFDCKYCApi() | |||||
} | |||||
// 650 -> refreshToken() | |||||
else -> { | |||||
showDialogValidation(this@BajajFdMainActivity, response.message) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
showDialogValidation(this@BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
hideLoading() | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
private fun setViewPager(stepsCount: Int) { | |||||
// steps setting | |||||
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape(), stepsCount) | |||||
if (stepCount == 3) { | |||||
fragments = arrayOf( | |||||
stepOneBajajFDFragment, | |||||
stepTwoBajajFDFragment, | |||||
stepFourBajajFDFragment, | |||||
stepFiveBajajFDFragment | |||||
) | |||||
} else if (stepCount == 4) { | |||||
fragments = arrayOf( | |||||
stepOneBajajFDFragment, | |||||
stepTwoBajajFDFragment, | |||||
stepThreeBajajFDFragment, | |||||
stepFourBajajFDFragment, | |||||
stepFiveBajajFDFragment | |||||
) | |||||
} | |||||
// set viewPager | |||||
sectionsPagerAdapter = SectionsPagerAdapter(supportFragmentManager, fragments) | |||||
val viewPager: DisableAdapter = binding.viewPager | |||||
viewPager.adapter = sectionsPagerAdapter | |||||
viewPager.setPagingEnabled(false) | |||||
if (sectionsPagerAdapter.count > 1) { | |||||
viewPager.offscreenPageLimit = stepCount | |||||
} else { | |||||
viewPager.offscreenPageLimit = 1 | |||||
} | |||||
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { | |||||
override fun onPageScrolled( | |||||
position: Int, | |||||
positionOffset: Float, | |||||
positionOffsetPixels: Int | |||||
) { | |||||
} | |||||
override fun onPageSelected(position: Int) { | |||||
when (position) { | |||||
0 -> { | |||||
setBackground( | |||||
defaultShape(), | |||||
defaultShape(), | |||||
defaultShape(), | |||||
defaultShape(), | |||||
stepsCount | |||||
) | |||||
} | |||||
1 -> { | |||||
setBackground( | |||||
selectedShape(), | |||||
defaultShape(), | |||||
defaultShape(), | |||||
defaultShape(), | |||||
stepsCount | |||||
) | |||||
} | |||||
2 -> { | |||||
setBackground( | |||||
selectedShape(), | |||||
selectedShape(), | |||||
defaultShape(), | |||||
defaultShape(), | |||||
stepsCount | |||||
) | |||||
} | |||||
3 -> { | |||||
setBackground( | |||||
selectedShape(), | |||||
selectedShape(), | |||||
selectedShape(), | |||||
defaultShape(), | |||||
stepsCount | |||||
) | |||||
} | |||||
4 -> { | |||||
setBackground( | |||||
selectedShape(), | |||||
selectedShape(), | |||||
selectedShape(), | |||||
selectedShape(), | |||||
stepsCount | |||||
) | |||||
} | |||||
} | |||||
} | |||||
override fun onPageScrollStateChanged(state: Int) { | |||||
} | |||||
}) | |||||
} | |||||
private fun checkFDCKYCApi() { | |||||
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { | |||||
if (getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN?.isNotEmpty()!! && getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE?.isNotEmpty()!!) { | |||||
val checkFDKYCRequest = CheckFDKYCRequest() | |||||
checkFDKYCRequest.Mobile = | |||||
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE | |||||
checkFDKYCRequest.DOB = | |||||
getDate(getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB!!) | |||||
checkFDKYCRequest.PAN = | |||||
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN | |||||
checkFDKYCRequest.NiveshClientCode = | |||||
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString() | |||||
viewModel.checkFDKYC(checkFDKYCRequest, token, this) | |||||
viewModel.getFDKYCMutableData.observe(this) { response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("response", "-->${response.data.toString()}") | |||||
val getCodeResponse: GetCodeResponse = | |||||
Gson().fromJson( | |||||
response.data?.toString(), | |||||
GetCodeResponse::class.java | |||||
) | |||||
getCodeResponse.Response.StatusCode.let { code -> | |||||
when (code) { | |||||
200 -> { | |||||
fdInvestmentDetails.CustomerType = "" | |||||
} | |||||
// 650 -> refreshToken() | |||||
else -> { | |||||
showDialogValidation( | |||||
this@BajajFdMainActivity, | |||||
getCodeResponse.Response.Errors[0].ErrorMessage | |||||
) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
showDialogValidation(this@BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
// set background for selected/ default step | |||||
private fun setBackground( | |||||
drawable: Drawable?, | |||||
drawable1: Drawable?, | |||||
drawable2: Drawable?, | |||||
drawable3: Drawable?, | |||||
stepsCount: Int | |||||
) { | |||||
binding.stepOne.background = drawable | |||||
binding.stepTwo.background = drawable1 | |||||
binding.stepThree.background = drawable2 | |||||
if (stepsCount == 4) { | |||||
binding.stepFour.background = drawable3 | |||||
} | |||||
} | |||||
// step 1 response | |||||
fun stepOneApi() { | |||||
binding.viewPager.currentItem = 1 | |||||
} | |||||
// step 2 response | |||||
fun stepTwoApi() { | |||||
binding.viewPager.currentItem = 2 | |||||
if (stepCount == 3) { | |||||
stepFourBajajFDFragment.displayReceivedData() | |||||
} | |||||
} | |||||
// step 3 response | |||||
fun stepThreeApi() { | |||||
binding.viewPager.currentItem = 3 | |||||
stepFourBajajFDFragment.displayReceivedData() | |||||
} | |||||
// step 4 response | |||||
fun stepFourApi(payUrl: String, value: String) { | |||||
paymentDialog(payUrl, value) | |||||
} | |||||
@SuppressLint("SetJavaScriptEnabled") | |||||
fun paymentDialog(payUrl: String, value: String) { | |||||
Log.e("payUrl", "-->$payUrl") | |||||
Log.e("value", "-->$value") | |||||
dialogWebView = Dialog(this@BajajFdMainActivity) | |||||
dialogWebView!!.setContentView(R.layout.row_fd_pay) | |||||
dialogWebView!!.setCancelable(true) | |||||
val tvCancel = dialogWebView!!.findViewById<TextView>(R.id.tvCancel) | |||||
tvCancel.setOnClickListener { | |||||
dialogWebView!!.dismiss() | |||||
} | |||||
val lp = WindowManager.LayoutParams() | |||||
lp.copyFrom(dialogWebView!!.window?.attributes) | |||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT | |||||
lp.height = WindowManager.LayoutParams.MATCH_PARENT | |||||
dialogWebView!!.window?.attributes = lp | |||||
val wVPay = dialogWebView!!.findViewById<WebView>(R.id.wVPay) | |||||
wVPay.settings.javaScriptEnabled = true | |||||
wVPay.settings.domStorageEnabled = true | |||||
wVPay.loadData( | |||||
"<form name=\"frm\" action=\"$payUrl\" method=\"post\"> \n" + " <input type=\"hidden\" name=\"msg\" value=\"$value\"> \n" + " </form> \n" + | |||||
"<script type=\"text/javascript\"> \n" + "document.forms[\"frm\"].submit(); \n" + "</script>", | |||||
"text/html", | |||||
"UTF-8" | |||||
) | |||||
wVPay.webViewClient = object : WebViewClient() { | |||||
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) { | |||||
super.onPageStarted(view, url, favicon) | |||||
Log.e("onPageStarted", "-->$url") | |||||
if (url.isNotEmpty() && url.contains("https://uat.nivesh.com/bajajFD/OrderStatus")) { | |||||
if (dialogWebView != null && dialogWebView!!.isShowing) { | |||||
dialogWebView!!.dismiss() | |||||
paymentReQueryApi() | |||||
} | |||||
} | |||||
} | |||||
} | |||||
dialogWebView!!.show() | |||||
} | |||||
fun paymentReQueryApi() { | |||||
if (Common.isNetworkAvailable(this)) { | |||||
val paymentReQueryRequest = PaymentReQueryRequest() | |||||
paymentReQueryRequest.UniqueId = uniqueId | |||||
paymentReQueryRequest.NiveshClientCode = | |||||
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE | |||||
ProgressUtil.showLoading(this@BajajFdMainActivity) | |||||
viewModel.getPaymentReQuery(paymentReQueryRequest, token, this) | |||||
viewModel.getPaymentReQueryMutableData.observe(this) { response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("paymentReQueryApi ", "response -->$response") | |||||
val paymentReQueryResponse: PaymentReQueryResponse = | |||||
Gson().fromJson( | |||||
response.data?.toString(), | |||||
PaymentReQueryResponse::class.java | |||||
) | |||||
paymentReQueryResponse.Response.StatusCode.let { code -> | |||||
when (code) { | |||||
650 -> "" | |||||
else -> { | |||||
if (stepCount == 4) { | |||||
binding.viewPager.currentItem = 4 | |||||
} else { | |||||
binding.viewPager.currentItem = 3 | |||||
} | |||||
stepFiveBajajFDFragment.getData(paymentReQueryResponse) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
showDialogValidation(this@BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
hideLoading() | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@ -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,173 @@ | |||||
package com.nivesh.production.bajajfd.ui.fragment | |||||
import android.os.Bundle | |||||
import android.util.Log | |||||
import android.view.LayoutInflater | |||||
import android.view.View | |||||
import android.view.ViewGroup | |||||
import androidx.core.content.ContextCompat | |||||
import androidx.fragment.app.Fragment | |||||
import com.google.gson.Gson | |||||
import com.nivesh.production.bajajfd.R | |||||
import com.nivesh.production.bajajfd.databinding.FragmentBajajfdStepFiveBinding | |||||
import com.nivesh.production.bajajfd.model.* | |||||
import com.nivesh.production.bajajfd.ui.activity.BajajFdMainActivity | |||||
import com.nivesh.production.bajajfd.util.Common | |||||
import com.nivesh.production.bajajfd.util.Constants | |||||
import com.nivesh.production.bajajfd.util.Resource | |||||
class StepFiveBajajFDFragment : Fragment() { | |||||
private var _binding: FragmentBajajfdStepFiveBinding? = null | |||||
private val binding get() = _binding!! | |||||
override fun onCreateView( | |||||
inflater: LayoutInflater, container: ViewGroup?, | |||||
savedInstanceState: Bundle? | |||||
): View { | |||||
_binding = FragmentBajajfdStepFiveBinding.inflate(inflater, container, false) | |||||
return binding.root | |||||
} | |||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |||||
super.onViewCreated(view, savedInstanceState) | |||||
binding.tvCongrats.text = "" | |||||
binding.tvSuccessMessage.text = "" | |||||
binding.btnViewOrder.setOnClickListener { | |||||
} | |||||
} | |||||
fun getData(paymentReQueryResponse: PaymentReQueryResponse) { | |||||
if (paymentReQueryResponse.Response.StatusCode == 200) { | |||||
if (paymentReQueryResponse.Response.Message.isNotEmpty()) { | |||||
val arrOfStr: List<String> = paymentReQueryResponse.Response.Message.split(" ", limit = 2) | |||||
binding.tvCongrats.text = arrOfStr[0] | |||||
binding.tvCongrats.setTextColor( | |||||
ContextCompat.getColor( | |||||
activity as BajajFdMainActivity, | |||||
R.color.green | |||||
) | |||||
) | |||||
binding.tvSuccessMessage.text = arrOfStr[1] | |||||
} | |||||
}else{ | |||||
if (paymentReQueryResponse.Response.Message.isNotEmpty()) { | |||||
val arrOfStr: List<String> = paymentReQueryResponse.Response.Message.split(" ", limit = 2) | |||||
binding.tvCongrats.text = arrOfStr[0] | |||||
binding.tvCongrats.setTextColor( | |||||
ContextCompat.getColor( | |||||
activity as BajajFdMainActivity, | |||||
R.color.red | |||||
) | |||||
) | |||||
binding.tvSuccessMessage.text = arrOfStr[1] | |||||
} | |||||
} | |||||
finalizeFDApi() | |||||
finalizeKYCApi() | |||||
} | |||||
private fun finalizeFDApi() { | |||||
val finalizeFDRequest = FinalizeFDRequest() | |||||
val finaliseFD = FinaliseFD() | |||||
finaliseFD.FDProvider = getString(R.string.bajaj) | |||||
finaliseFD.NiveshClientCode = (activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE | |||||
finaliseFD.UniqueId = (activity as BajajFdMainActivity).uniqueId | |||||
finalizeFDRequest.FinaliseFD = finaliseFD | |||||
(activity as BajajFdMainActivity).viewModel.finaliseFD( | |||||
finalizeFDRequest, Constants.token, activity as BajajFdMainActivity | |||||
) | |||||
(activity as BajajFdMainActivity).viewModel.getFinalizeFDMutableData.observe(viewLifecycleOwner){ response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("finalizeKYC ", " response-->${response.data.toString()}") | |||||
val finalizeFDResponse: FinalizeFDResponse = | |||||
Gson().fromJson(response.data?.toString(), FinalizeFDResponse::class.java) | |||||
finalizeFDResponse.Response.StatusCode.let { code -> | |||||
when (code) { | |||||
200 -> { | |||||
} | |||||
650 -> "" | |||||
else -> { | |||||
Common.showDialogValidation( | |||||
activity as BajajFdMainActivity, | |||||
finalizeFDResponse.Response.Errors[0].ErrorMessage | |||||
) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
Common.showDialogValidation(activity as BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
private fun finalizeKYCApi() { | |||||
val finalizeKYCRequest = FinalizeKYCRequest() | |||||
finalizeKYCRequest.FDProvider = getString(R.string.bajaj) | |||||
finalizeKYCRequest.NiveshClientCode = (activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE | |||||
finalizeKYCRequest.UniqueId = (activity as BajajFdMainActivity).uniqueId | |||||
(activity as BajajFdMainActivity).viewModel.finaliseKYC( | |||||
finalizeKYCRequest, Constants.token, activity as BajajFdMainActivity | |||||
) | |||||
(activity as BajajFdMainActivity).viewModel.getFinalizeKYCMutableData.observe(viewLifecycleOwner){ response -> | |||||
when (response) { | |||||
is Resource.Success -> { | |||||
Log.e("finalizeKYC ", " response-->${response.data.toString()}") | |||||
val finalizeFDResponse: FinalizeFDResponse = | |||||
Gson().fromJson(response.data?.toString(), FinalizeFDResponse::class.java) | |||||
finalizeFDResponse.Response.StatusCode.let { code -> | |||||
when (code) { | |||||
200 -> { | |||||
} | |||||
650 -> "" | |||||
else -> { | |||||
Common.showDialogValidation( | |||||
activity as BajajFdMainActivity, | |||||
finalizeFDResponse.Response.Errors[0].ErrorMessage | |||||
) | |||||
} | |||||
} | |||||
} | |||||
} | |||||
is Resource.Error -> { | |||||
response.message?.let { message -> | |||||
Common.showDialogValidation(activity as BajajFdMainActivity, message) | |||||
} | |||||
} | |||||
is Resource.Loading -> { | |||||
} | |||||
is Resource.DataError -> { | |||||
} | |||||
} | |||||
} | |||||
} | |||||
override fun onDestroyView() { | |||||
super.onDestroyView() | |||||
_binding = null | |||||
} | |||||
} |
Powered by TurnKey Linux.