Browse Source

bank card

pankaj 2 years ago
parent
commit
d24531554d
18 changed files with 478 additions and 228 deletions
  1. +2
    -0
      app/src/main/AndroidManifest.xml
  2. +137
    -0
      app/src/main/java/com/nivesh/production/niveshfd/db/PreferenceManager.kt
  3. +30
    -0
      app/src/main/java/com/nivesh/production/niveshfd/interfaces/IPreferenceHelper.kt
  4. +2
    -1
      app/src/main/java/com/nivesh/production/niveshfd/model/FDInvestmentDetails.kt
  5. +24
    -62
      app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
  6. +5
    -6
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFiveNiveshFDFragment.kt
  7. +4
    -4
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt
  8. +17
    -7
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt
  9. +81
    -70
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepTwoNiveshFDFragment.kt
  10. +118
    -21
      app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt
  11. +6
    -15
      app/src/main/java/com/nivesh/production/niveshfd/viewModel/BajajFDViewModel.kt
  12. +3
    -5
      app/src/main/res/layout/fragment_niveshfd_step_four.xml
  13. +4
    -11
      app/src/main/res/layout/fragment_niveshfd_step_one.xml
  14. +10
    -8
      app/src/main/res/layout/fragment_niveshfd_step_two.xml
  15. +2
    -1
      app/src/main/res/layout/item_customer_list_preview.xml
  16. +15
    -7
      app/src/main/res/values-hi-rIN/strings.xml
  17. +16
    -8
      app/src/main/res/values/strings.xml
  18. +2
    -2
      app/src/main/res/values/themes.xml

+ 2
- 0
app/src/main/AndroidManifest.xml View File

@ -4,11 +4,13 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
<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-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature
android:name="android.hardware.camera"


+ 137
- 0
app/src/main/java/com/nivesh/production/niveshfd/db/PreferenceManager.kt View File

@ -0,0 +1,137 @@
package com.nivesh.production.niveshfd.db
import android.content.Context
import android.content.SharedPreferences
import com.nivesh.production.niveshfd.interfaces.IPreferenceHelper
open class PreferenceManager(context: Context) : IPreferenceHelper {
private val preferenceName = "NiveshFDSDK"
private var preferences: SharedPreferences = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE)
companion object {
const val KEY_USER_UID = "UserUid"
const val KEY_LOGIN_ROLE = "LoginRole"
const val KEY_SUB_BROKER_CODE = "SubBrokerCode"
const val KEY_LOGIN_PASSWORD = "LOGIN_PASSWORD"
const val KEY_CLIENT_UMS_ID = "UMS_Id"
const val KEY_CLIENT_CODE = "ClientCode"
const val KEY_GET_TOKEN = "GetToken"
const val CLIENT_LANGUAGE = "LANGUAGE"
}
override fun getLoginPasswordHash(): String {
return preferences[KEY_LOGIN_PASSWORD] ?: ""
}
override fun setLoginPasswordHash(appName: String) {
preferences[KEY_LOGIN_PASSWORD] = appName
}
override fun setUserUid(appName: Int) {
preferences[KEY_USER_UID] = appName
}
override fun getUserUid(): Int {
return preferences[KEY_USER_UID] ?: -1
}
override fun setLoginRole(appName: Int) {
preferences[KEY_LOGIN_ROLE] = appName
}
override fun getLoginRole(): Int {
return preferences[KEY_LOGIN_ROLE] ?: -1
}
override fun setSubBrokerID(appName: String) {
preferences[KEY_SUB_BROKER_CODE] = appName
}
override fun getSubBrokerID(): String {
return preferences[KEY_SUB_BROKER_CODE] ?: ""
}
override fun setClientUmsID(appName: String) {
preferences[KEY_CLIENT_UMS_ID] = appName
}
override fun getClientUmsID(): String {
return preferences[KEY_CLIENT_UMS_ID] ?: ""
}
override fun setClientCode(appName: String) {
preferences[KEY_CLIENT_CODE] = appName
}
override fun getClientCode(): String {
return preferences[KEY_CLIENT_CODE] ?: ""
}
override fun setToken(appName: String) {
preferences[KEY_GET_TOKEN] = appName
}
override fun getToken(): String {
return preferences[KEY_GET_TOKEN] ?: ""
}
override fun setLanguage(appName: String) {
preferences[CLIENT_LANGUAGE] = appName
}
override fun getLanguage(): String {
return preferences[CLIENT_LANGUAGE] ?: ""
}
override fun clearPrefs() {
preferences.edit().clear().apply()
}
}
/**
* SharedPreferences extension function, to listen the edit() and apply() fun calls
* on every SharedPreferences operation.
*/
private inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {
val editor = this.edit()
operation(editor)
editor.apply()
}
/**
* puts a key value pair in shared prefs if doesn't exists, otherwise updates value on given [key]
*/
private operator fun SharedPreferences.set(key: String, value: Any?) {
when (value) {
is String? -> edit { it.putString(key, value) }
is Int -> edit { it.putInt(key, value) }
is Boolean -> edit { it.putBoolean(key, value) }
is Float -> edit { it.putFloat(key, value) }
is Long -> edit { it.putLong(key, value) }
else -> throw UnsupportedOperationException("Not yet implemented")
}
}
/**
* finds value on given key.
* [T] is the type of value
* @param defaultValue optional default value - will take null for strings, false for bool and -1 for numeric values if [defaultValue] is not specified
*/
private inline operator fun <reified T : Any> SharedPreferences.get(
key: String,
defaultValue: T? = null
): T? {
return when (T::class) {
String::class -> getString(key, defaultValue as? String) as T?
Int::class -> getInt(key, defaultValue as? Int ?: -1) as T?
Boolean::class -> getBoolean(key, defaultValue as? Boolean ?: false) as T?
Float::class -> getFloat(key, defaultValue as? Float ?: -1f) as T?
Long::class -> getLong(key, defaultValue as? Long ?: -1) as T?
else -> throw UnsupportedOperationException("Not yet implemented")
}
}

+ 30
- 0
app/src/main/java/com/nivesh/production/niveshfd/interfaces/IPreferenceHelper.kt View File

@ -0,0 +1,30 @@
package com.nivesh.production.niveshfd.interfaces
interface IPreferenceHelper {
fun getLoginPasswordHash(): String
fun setLoginPasswordHash(appName: String)
fun getUserUid(): Int
fun setUserUid(appName: Int)
fun getLoginRole(): Int
fun setLoginRole(appName: Int)
fun getSubBrokerID(): String
fun setSubBrokerID(appName: String)
fun getClientUmsID(): String
fun setClientUmsID(appName: String)
fun getClientCode(): String
fun setClientCode(appName: String)
fun setToken(appName: String)
fun getToken(): String
fun setLanguage(appName: String)
fun getLanguage(): String
fun clearPrefs()
}

+ 2
- 1
app/src/main/java/com/nivesh/production/niveshfd/model/FDInvestmentDetails.kt View File

@ -13,6 +13,7 @@ data class FDInvestmentDetails(
var Provider: String? = null,
var Source: String? = null,
var Tenure: Int? = 0,
var UniqueId: String? = ""
var UniqueId: String? = "",
var RenewOption : String = ""
)

+ 24
- 62
app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt View File

@ -21,13 +21,13 @@ import com.nivesh.production.niveshfd.adapter.DisableAdapter
import com.nivesh.production.niveshfd.adapter.SectionsPagerAdapter
import com.nivesh.production.niveshfd.api.ApiClient
import com.nivesh.production.niveshfd.databinding.ActivityNiveshFdBinding
import com.nivesh.production.niveshfd.db.PreferenceManager
import com.nivesh.production.niveshfd.model.*
import com.nivesh.production.niveshfd.repositories.MainRepository
import com.nivesh.production.niveshfd.ui.fragment.*
import com.nivesh.production.niveshfd.ui.providerfactory.*
import com.nivesh.production.niveshfd.util.Common
import com.nivesh.production.niveshfd.util.Common.Companion.defaultShape
import com.nivesh.production.niveshfd.util.Common.Companion.getDate
import com.nivesh.production.niveshfd.util.Common.Companion.selectedShape
import com.nivesh.production.niveshfd.util.Common.Companion.showDialogValidation
import com.nivesh.production.niveshfd.util.Constants.Companion.token
@ -56,12 +56,13 @@ class NiveshFdMainActivity : BaseActivity() {
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
var stepCount: Int = 0
var uniqueId: String = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -79,6 +80,11 @@ class NiveshFdMainActivity : BaseActivity() {
setContentView(this.root)
}
// For Set Data
PreferenceManager(this@NiveshFdMainActivity).setSubBrokerID("")
// For Get Data
PreferenceManager(context = this@NiveshFdMainActivity).getSubBrokerID()
loginRole = 5
if (Common.isNetworkAvailable(this)) {
getStepsCountApi()
@ -134,6 +140,10 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}
@ -179,11 +189,13 @@ class NiveshFdMainActivity : BaseActivity() {
when (code) {
200 -> {
setViewPager(stepsCount)
checkFDCKYCApi()
}
// 650 -> refreshToken()
650 -> ""
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
showDialogValidation(
this@NiveshFdMainActivity,
response.message
)
}
}
}
@ -200,6 +212,9 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}
@ -301,62 +316,6 @@ class NiveshFdMainActivity : BaseActivity() {
}
private fun checkFDCKYCApi() {
if (Common.isNetworkAvailable(this@NiveshFdMainActivity)) {
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@NiveshFdMainActivity,
getCodeResponse.Response.Errors[0].ErrorMessage
)
}
}
}
}
is Resource.Error -> {
response.message?.let { message ->
showDialogValidation(this@NiveshFdMainActivity, message)
}
}
is Resource.Loading -> {
}
is Resource.DataError -> {
}
}
}
}
}
}
// set background for selected/ default step
private fun setBackground(
@ -481,6 +440,9 @@ class NiveshFdMainActivity : BaseActivity() {
is Resource.DataError -> {
}
else -> {
showDialogValidation(this@NiveshFdMainActivity, response.message)
}
}
}
}


+ 5
- 6
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFiveNiveshFDFragment.kt View File

@ -55,26 +55,25 @@ class StepFiveNiveshFDFragment : Fragment() {
)
binding.tvSuccessMessage.text = arrOfStr[1]
}
finalizeFDApi()
finalizeKYCApi()
}else{
if (paymentReQueryResponse.Response.Message.isNotEmpty()) {
if (paymentReQueryResponse.Response.Message.isNotEmpty()) {
val arrOfStr: List<String> =
paymentReQueryResponse.Response.Message.split(" ", limit = 2)
binding.tvCongrats.text = arrOfStr[0]
binding.tvCongrats.text = paymentReQueryResponse.Response.Status
binding.tvCongrats.setTextColor(
ContextCompat.getColor(
activity as NiveshFdMainActivity,
R.color.red
)
)
binding.tvSuccessMessage.text = arrOfStr[1]
binding.tvSuccessMessage.text = paymentReQueryResponse.Response.Message
}
}
binding.tvRetry.visibility = View.VISIBLE
binding.btnViewOrder.visibility = View.GONE
}
finalizeFDApi()
finalizeKYCApi()
}
private fun finalizeFDApi() {


+ 4
- 4
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt View File

@ -98,20 +98,20 @@ class StepFourNiveshFDFragment : Fragment() {
}
private fun validated(): Boolean {
if (selectedList.isEmpty()) {
return if (selectedList.isEmpty()) {
showDialogValidation(
activity as NiveshFdMainActivity,
getString(R.string.validTermsCondition)
)
return false
false
} else if (!binding.checkBox.isChecked) {
showDialogValidation(
activity as NiveshFdMainActivity,
resources.getString(R.string.validTermsConditions)
)
return false
false
} else {
return true
true
}
}


+ 17
- 7
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt View File

@ -109,10 +109,15 @@ class StepOneNiveshFDFragment : Fragment() {
}
// Maturity Options
rgMaturity.text = getString(R.string.additionalDetailOne)
rgMaturity.text = getString(R.string.totalDeduction)
binding.radioGroup.setOnCheckedChangeListener { group, checkedId ->
rgMaturity = group.findViewById(checkedId)
Log.e("Maturity", "-->" + rgMaturity.text)
if (rgMaturity.text.contains("credit")){
rgMaturity.text = getString(R.string.totalDeduction)
}else{
rgMaturity.text = getString(R.string.principalDeduction)
}
}
// Next Button
@ -146,6 +151,7 @@ class StepOneNiveshFDFragment : Fragment() {
(activity as NiveshFdMainActivity).fdInvestmentDetails.CKYCNumber = ""
(activity as NiveshFdMainActivity).fdInvestmentDetails.UniqueId =
(activity as NiveshFdMainActivity).uniqueId
(activity as NiveshFdMainActivity).fdInvestmentDetails.RenewOption = rgMaturity.text.toString()
(activity as NiveshFdMainActivity).createFDApplicantRequest.FDInvestmentDetails =
(activity as NiveshFdMainActivity).fdInvestmentDetails
@ -252,11 +258,9 @@ class StepOneNiveshFDFragment : Fragment() {
when (code) {
200 -> {
listOfMinAmount = getCodeResponse.Response.GetCodesList
if (listOfMinAmount.isNotEmpty()) {
binding.txtMinAmount.text = getString(R.string.minAmount).plus(
listOfMinAmount[0].Value
)
}
// if (listOfMinAmount.isNotEmpty()) {
// binding.txtMinAmount.text = getString(R.string.minAmount).plus(listOfMinAmount[0].Value)
// }
maxAmountApi()
}
650 -> ""
@ -432,7 +436,13 @@ class StepOneNiveshFDFragment : Fragment() {
binding.tlDepositAmount,
getString(R.string.validMinAmount)
)
} else if (binding.edtAmount.text.toString()
} else if (binding.edtAmount.text.toString().toInt() % 1000 != 0) {
commonErrorMethod(
binding.edtAmount,
binding.tlDepositAmount,
getString(R.string.validMultipleAmount)
)
}else if (binding.edtAmount.text.toString()
.toDouble() > listOfMaxAmount[0].Value.toDouble()
) {
commonErrorMethod(


+ 81
- 70
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepTwoNiveshFDFragment.kt View File

@ -31,6 +31,7 @@ import com.nivesh.production.niveshfd.adapter.RecommendedBankListAdapter
import com.nivesh.production.niveshfd.databinding.FragmentNiveshfdStepTwoBinding
import com.nivesh.production.niveshfd.model.*
import com.nivesh.production.niveshfd.ui.activity.NiveshFdMainActivity
import com.nivesh.production.niveshfd.util.Common
import com.nivesh.production.niveshfd.util.Common.Companion.commonErrorAutoCompleteMethod
import com.nivesh.production.niveshfd.util.Common.Companion.commonErrorMethod
import com.nivesh.production.niveshfd.util.Common.Companion.commonSpinnerErrorMethod
@ -38,6 +39,7 @@ import com.nivesh.production.niveshfd.util.Common.Companion.getDate
import com.nivesh.production.niveshfd.util.Common.Companion.isIndianMobileNo
import com.nivesh.production.niveshfd.util.Common.Companion.isMinor
import com.nivesh.production.niveshfd.util.Common.Companion.isValidEmail
import com.nivesh.production.niveshfd.util.Common.Companion.isValidIndividualPan
import com.nivesh.production.niveshfd.util.Common.Companion.isValidName
import com.nivesh.production.niveshfd.util.Common.Companion.isValidPan
import com.nivesh.production.niveshfd.util.Common.Companion.removeError
@ -139,7 +141,7 @@ class StepTwoNiveshFDFragment : Fragment() {
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
removeError(binding.tlPanNumber)
if (s.toString().trim().length == 10) {
panCheckApi()
checkFDCKYCApi()
}
}
})
@ -563,10 +565,10 @@ class StepTwoNiveshFDFragment : Fragment() {
}
}
binding.tvBankDetails.setOnClickListener {
if (binding.llBankDetails.visibility == View.VISIBLE) {
binding.llBankDetails.visibility = View.GONE
if (binding.llBank.visibility == View.VISIBLE) {
binding.llBank.visibility = View.GONE
} else {
binding.llBankDetails.visibility = View.VISIBLE
binding.llBank.visibility = View.VISIBLE
}
}
@ -715,6 +717,55 @@ class StepTwoNiveshFDFragment : Fragment() {
}
private fun checkFDCKYCApi() {
if ((activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CM_MOBILE?.isNotEmpty()!! && (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB?.isNotEmpty()!! && binding.edtPANNumber.text.toString().isNotEmpty() && (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE?.isNotEmpty()!!) {
val checkFDKYCRequest = CheckFDKYCRequest()
checkFDKYCRequest.Mobile = binding.edtMobileNumber.text.toString()
checkFDKYCRequest.DOB = binding.edtDOB.text.toString()
checkFDKYCRequest.PAN = binding.edtPANNumber.text.toString()
checkFDKYCRequest.NiveshClientCode = (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString()
(activity as NiveshFdMainActivity).viewModel.checkFDKYC(checkFDKYCRequest, token, activity as NiveshFdMainActivity)
(activity as NiveshFdMainActivity).viewModel.getFDKYCMutableData.observe(this) { response ->
when (response) {
is Resource.Success -> {
Log.e("response", "-->${response.data.toString()}")
val getCodeResponse: GetCodeResponse =
Gson().fromJson(
response.data?.toString(),
GetCodeResponse::class.java
)
getCodeResponse.Response.StatusCode.let { code ->
when (code) {
200 -> {
// fdInvestmentDetails.CustomerType = ""
}
650 -> ""
else -> {
showDialogValidation(
activity as NiveshFdMainActivity,
getCodeResponse.Response.Errors[0].ErrorMessage
)
}
}
}
}
is Resource.Error -> {
response.message?.let { message ->
showDialogValidation(activity as NiveshFdMainActivity, message)
}
}
is Resource.Loading -> {
}
is Resource.DataError -> {
}
}
}
}
}
private fun createFDApi(data: CreateFDRequest) {
ProgressUtil.showLoading(activity as NiveshFdMainActivity)
(activity as NiveshFdMainActivity).viewModel.createFDApi(data, token, activity as NiveshFdMainActivity)
@ -1046,67 +1097,6 @@ class StepTwoNiveshFDFragment : Fragment() {
}
private fun panCheckApi() {
val panCheck = PanCheckRequest()
panCheck.clientCode =
(activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE
panCheck.subBrokerCode =
(activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.sub_broker_code
panCheck.panNumber = binding.edtPANNumber.text.toString()
panCheck.mobileNumber = ""
(activity as NiveshFdMainActivity).viewModel.panCheck(panCheck, token, activity as NiveshFdMainActivity)
(activity as NiveshFdMainActivity).viewModel.getPanCheckMutableData.observe(viewLifecycleOwner) { response ->
when (response) {
is Resource.Success -> {
Log.e("panCheckApi ", " response -->$response")
val panCheckResponse =
Gson().fromJson(
response.data?.toString(),
PanCheckResponse::class.java
)
panCheckResponse.response.status_code.let { code ->
if (binding.tvPANVerify.visibility == View.GONE) {
binding.tvPANVerify.visibility = View.VISIBLE
}
when (code) {
200 -> {
binding.tvPANVerify.text = getString(R.string.verifiedText)
binding.tvPANVerify.setTextColor(
ContextCompat.getColor(
activity as NiveshFdMainActivity,
R.color.green
)
)
}
// 650 -> refreshToken()
else -> {
binding.tvPANVerify.text = getString(R.string.notVerifiedText)
binding.tvPANVerify.setTextColor(
ContextCompat.getColor(
activity as NiveshFdMainActivity,
R.color.red
)
)
}
}
}
}
is Resource.Error -> {
response.message?.let { message ->
showDialogValidation(activity as NiveshFdMainActivity, message)
}
}
is Resource.Loading -> {
}
is Resource.DataError -> {
}
}
}
}
private fun titleApi() {
val getCodeRequest = GetCodeRequest()
getCodeRequest.ProductName = getString(R.string.bajajFD)
@ -1498,10 +1488,22 @@ class StepTwoNiveshFDFragment : Fragment() {
listOfOccupation
)
binding.spOccupation.setAdapter(adapter)
binding.spOccupation.setText(
adapter.getItem(0)?.Label,
false
)
val occupationCode = (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_OCCUPATION_CODE
if (occupationCode.isNullOrEmpty()) {
binding.spOccupation.setText(
adapter.getItem(0)?.Label,
false
)
}else{
for (title in listOfOccupation) {
if (title.Value == occupationCode) {
binding.spOccupation.setText(title.Label, false)
break
}
}
}
}
}
// 650 -> refreshToken()
@ -1834,7 +1836,10 @@ class StepTwoNiveshFDFragment : Fragment() {
)
} else if (binding.edtDOB.text.toString().isEmpty()) { // EditText
commonErrorMethod(binding.edtDOB, binding.tlDOB, getString(R.string.emptyDOB))
} else if (binding.edtPANNumber.text.toString().isEmpty()) { // EditText
}else if (isMinor(binding.edtDOB.text.toString())) { // EditText
commonErrorMethod(binding.edtDOB, binding.tlDOB, getString(R.string.minorApplicant))
}
else if (binding.edtPANNumber.text.toString().isEmpty()) { // EditText
commonErrorMethod(
binding.edtPANNumber,
binding.tlPanNumber,
@ -1846,6 +1851,12 @@ class StepTwoNiveshFDFragment : Fragment() {
binding.tlPanNumber,
getString(R.string.invalidPAN)
)
} else if (!isValidIndividualPan(binding.edtPANNumber.text.toString())) { // EditText
commonErrorMethod(
binding.edtPANNumber,
binding.tlPanNumber,
getString(R.string.invalidIndividualPAN)
)
} else if (binding.spTitle.text.isEmpty()) { // Spinner
commonSpinnerErrorMethod(
binding.spTitle,


+ 118
- 21
app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt View File

@ -1,9 +1,12 @@
package com.nivesh.production.niveshfd.util
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.net.ConnectivityManager
@ -11,14 +14,18 @@ import android.net.NetworkCapabilities
import android.net.Uri
import android.os.Build
import android.provider.Settings
import android.telephony.TelephonyManager
import android.text.TextUtils
import android.text.format.DateFormat
import android.util.Log
import android.util.Patterns
import androidx.core.app.ActivityCompat
import com.google.android.material.textfield.MaterialAutoCompleteTextView
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
import com.google.gson.JsonObject
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.model.DeviceInfo
import com.nivesh.production.niveshfd.ui.activity.NiveshFdMainActivity
import kotlinx.coroutines.CoroutineExceptionHandler
import org.json.JSONObject
@ -90,6 +97,12 @@ class Common {
return mMatcher.matches()
}
fun isValidIndividualPan(pan: String?): Boolean {
val mPattern = Pattern.compile("[A-Z]{3}[P][A-Z][0-9]{4}[A-Z]")
val mMatcher = mPattern.matcher(pan.toString())
return mMatcher.matches()
}
//is Indian mobile Number
fun isIndianMobileNo(mobileNumber: String?): Boolean {
//(0/91): number starts with (0/91)
@ -131,7 +144,11 @@ class Common {
builder.setPositiveButton(activity.getString(R.string.Ok)) { dialogInterface, _ ->
val intent = Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.fromParts("package", (activity as NiveshFdMainActivity).packageName, null)
Uri.fromParts(
"package",
(activity as NiveshFdMainActivity).packageName,
null
)
)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
activity.startActivity(intent)
@ -208,20 +225,20 @@ class Common {
return Resource.Error(response.message())
}
fun handleResponse1(response: Response<String>): Resource<String> {
if (response.isSuccessful && response.body() != null) {
return if (response.body().toString().isNotEmpty()) {
Log.e("response", "-->$response")
val str: String = response.body().toString().replace("\r\n", "")
Log.e("str", "-->$str")
val jsonObject = JSONObject(str)
Log.e("jsonObject", "-->$jsonObject")
Resource.Success(jsonObject.toString())
}else {
Resource.Error(response.message())
}
}
return Resource.Error(response.message())
fun handleResponse1(response: Response<String>): Resource<String> {
if (response.isSuccessful && response.body() != null) {
return if (response.body().toString().isNotEmpty()) {
Log.e("response", "-->$response")
val str: String = response.body().toString().replace("\r\n", "")
Log.e("str", "-->$str")
val jsonObject = JSONObject(str)
Log.e("jsonObject", "-->$jsonObject")
Resource.Success(jsonObject.toString())
} else {
Resource.Error(response.message())
}
}
return Resource.Error(response.message())
}
@ -255,12 +272,11 @@ class Common {
}
/* this function is used for file size in readable format(End)*/
fun getFileSizeInMB(length: Long): Double {
// Get length of file in bytes
val fileSizeInBytes = length.toDouble()
// Convert the bytes to Kilobytes (1 KB = 1024 Bytes)
val fileSizeInKB = fileSizeInBytes / 1024
// Convert the KB to MegaBytes (1 MB = 1024 KBytes)
fun getFileSizeInMB(length: Long): Double { // Get length of file in bytes
val fileSizeInBytes =
length.toDouble() // Convert the bytes to Kilobytes (1 KB = 1024 Bytes)
val fileSizeInKB =
fileSizeInBytes / 1024 // Convert the KB to MegaBytes (1 MB = 1024 KBytes)
return fileSizeInKB / 1024
}
@ -274,6 +290,87 @@ class Common {
}
@SuppressLint("HardwareIds")
fun getDeviceInfo(mContext: Context): DeviceInfo {
val deviceInfo = DeviceInfo()
var deviceId: String? = ""
try {
val telephonyManager =
mContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
deviceInfo.device_model = if (TextUtils.isEmpty(Build.DEVICE)) "" else Build.DEVICE
deviceInfo.device_os_version =
if (TextUtils.isEmpty(Build.VERSION.RELEASE)) "" else Build.VERSION.RELEASE
deviceInfo.device_name = if (TextUtils.isEmpty(Build.PRODUCT)) "" else Build.PRODUCT
deviceInfo.device_type = "Android"
if ((deviceId == null) || deviceId.isEmpty() || deviceId.equals(
"unknown",
ignoreCase = true
)
) {
deviceId = if (TextUtils.isEmpty(
Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
)
) "" else Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
}
// deviceInfo.device_id = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = deviceId
// deviceInfo.sdk_version = com.nivesh.production.BuildConfig.VERSION_NAME
if (ActivityCompat.checkSelfPermission(
mContext,
Manifest.permission.READ_PHONE_STATE
) != PackageManager.PERMISSION_GRANTED
) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
deviceId = telephonyManager.imei
if (deviceId == null) {
deviceId =
if (TextUtils.isEmpty(Build.getSerial())) "" else Build.getSerial()
}
} else {
deviceId = telephonyManager.deviceId
if (deviceId == null) {
deviceId =
if (TextUtils.isEmpty(Build.SERIAL)) "" else Build.SERIAL
}
}
} else {
deviceId = telephonyManager.deviceId
if (deviceId == null) {
deviceId = if (TextUtils.isEmpty(Build.SERIAL)) "" else Build.SERIAL
}
}
} catch (e: Exception) {
e.printStackTrace()
if ((deviceId == null) || deviceId.isEmpty() || deviceId.equals(
"unknown",
ignoreCase = true
)
) {
deviceId = if (TextUtils.isEmpty(
Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
)
) "" else Settings.Secure.getString(
mContext.contentResolver,
Settings.Secure.ANDROID_ID
)
}
// deviceInfo.deviceId = device_id + "#" + preferenceHelper.getAppName()
deviceInfo.device_id_for_UMSId = deviceId
}
return deviceInfo
}
}
}

+ 6
- 15
app/src/main/java/com/nivesh/production/niveshfd/viewModel/BajajFDViewModel.kt View File

@ -41,14 +41,7 @@ open class BajajFDViewModel(private val mainRepository: MainRepository) : ViewMo
}
}
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))
}
}
val getPaymentReQueryMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData()
fun getPaymentReQuery(requestBody: PaymentReQueryRequest, token : String, activity: Activity) = viewModelScope.launch(handleError(activity)) {
@ -125,14 +118,12 @@ open class BajajFDViewModel(private val mainRepository: MainRepository) : ViewMo
// Step 2
val getPanCheckMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData()
fun panCheck(panCheck: PanCheckRequest, token: String, activity : Activity) = viewModelScope.launch(
handleError(activity)
) {
val getFDKYCMutableData: MutableLiveData<Resource<JsonObject>> = MutableLiveData()
fun checkFDKYC(requestBody: CheckFDKYCRequest, token : String, activity: Activity) = viewModelScope.launch(handleError(activity)) {
if (Common.isNetworkAvailable(activity)) {
getPanCheckMutableData.postValue(Resource.Loading())
val response = mainRepository.panCheck(panCheck, token)
getPanCheckMutableData.postValue(handleResponse(response))
getFDKYCMutableData.postValue(Resource.Loading())
val response = mainRepository.checkFDKYCRequest(requestBody, token)
getFDKYCMutableData.postValue(handleResponse(response))
}
}


+ 3
- 5
app/src/main/res/layout/fragment_niveshfd_step_four.xml View File

@ -221,11 +221,7 @@
android:id="@+id/rvTerms"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/item_customer_list_preview"
/>
tools:listitem="@layout/item_customer_list_preview" />
</LinearLayout>
<CheckBox
@ -292,6 +288,8 @@
android:layout_marginBottom="@dimen/margin_15"
android:textColor="@color/white"
android:textSize="@dimen/text_size_14"
android:text="@string/pay"
android:background="@color/green"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/btnBack"


+ 4
- 11
app/src/main/res/layout/fragment_niveshfd_step_one.xml View File

@ -84,6 +84,7 @@
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:visibility="gone"
android:id="@+id/txtMinAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -176,6 +177,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10"
android:layout_marginEnd="@dimen/margin_10"
android:theme="@style/SCBSwitch"
android:text="@string/upto0.25next"
android:textColor="@color/black"
android:textSize="@dimen/text_size_12" />
@ -186,7 +188,7 @@
<TextView
android:id="@+id/tvMaturityInstruction"
style="@style/regularStyle"
style="@style/BoldStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/greyColor3"
@ -222,15 +224,6 @@
android:text="@string/additionalDetailTwo"
android:textSize="@dimen/text_size_12" />
<RadioButton
android:id="@+id/rbAutoBoth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/black"
android:text="@string/additionalDetailThree"
android:textSize="@dimen/text_size_12" />
</RadioGroup>
<TextView
@ -238,7 +231,7 @@
style="@style/semiBoldStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_20"
android:layout_marginStart="@dimen/margin_15"
android:layout_marginTop="@dimen/margin_10"
android:layout_marginEnd="@dimen/margin_15"
android:text="@string/taxDeductedAtSourceTds"


+ 10
- 8
app/src/main/res/layout/fragment_niveshfd_step_two.xml View File

@ -834,8 +834,12 @@
android:textSize="@dimen/text_size_14"
app:drawableRightCompat="@drawable/svg_down_arrow" />
<!-- RecyclerView for bankList and Add Bank-->
<LinearLayout
android:id="@+id/llBank"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- RecyclerView for bankList and Add Bank-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -846,10 +850,7 @@
android:id="@+id/rvClientBankList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
/>
android:orientation="horizontal" />
<TextView
android:id="@+id/addBankDetail"
@ -868,8 +869,7 @@
</LinearLayout>
<!-- Add Bank Field-->
<!-- Add Bank Field-->
<LinearLayout
android:id="@+id/llBankDetails"
android:layout_width="match_parent"
@ -1019,6 +1019,8 @@
android:textSize="@dimen/text_size_14" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"


+ 2
- 1
app/src/main/res/layout/item_customer_list_preview.xml View File

@ -19,7 +19,8 @@
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/tvCustomerName"
android:layout_width="wrap_content"
android:padding="@dimen/margin_4"
android:padding="@dimen/margin_7"
android:theme="@style/SCBSwitch"
android:layout_height="wrap_content"
android:layout_weight="0.13"
android:checked="false"


+ 15
- 7
app/src/main/res/values-hi-rIN/strings.xml View File

@ -44,13 +44,16 @@
<string name="minMaxValidation">Min. 12 months, Max. 60 months</string>
<string name="minAmountCategory">MINAmount</string>
<string name="MaxAmountCategory">MAXAmount</string>
<string name="totalDeduction">Total</string>
<string name="principalDeduction">Principal</string>
<!-- Validations -->
<string name="emptyAmount">Please enter amount</string>
<string name="emptyAmountFirst">Please enter amount first</string>
<string name="validMinAmount">Entered amount should be greater than minimum amount</string>
<string name="validMaxAmount">Entered amount should be less than 5 Cr.</string>
<string name="validMaxAmount">Entered amount should be up to 5 Cr only</string>
<string name="validMultipleAmount">Entered Amount should be multiples of 1000</string>
<string name="emptyInterestPayout">Please select Interest Payout</string>
<string name="emptyInterestTenure">Please select Investment Tenure</string>
@ -137,9 +140,12 @@
<string name="inValidMobileNumber">Mobile number should have at least 10 digits</string>
<string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string>
<string name="emptyDOB">Please select date of birth</string>
<string name="minorApplicant">Primary Applicant should not be minor</string>
<string name="emptyPAN">Please enter PAN number</string>
<string name="invalidPAN">Invalid PAN</string>
<string name="invalidPAN">Please enter valid PAN number</string>
<string name="invalidIndividualPAN">PAN Applicants should be individual</string>
<string name="accountVerified">Account Verified</string>
@ -209,6 +215,10 @@
<string name="addPhoto">Add Photo!</string>
<string name="cancel">Cancel</string>
<string name="aadhar">Aadhar</string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<!-- Step Four -->
<string name="makePayment">Make Payment</string>
@ -231,6 +241,7 @@
<string name="TransactionIsUnsuccessful">Your transaction is unsuccessful.</string>
<string name="tryAgainLater">Sorry for the inconvenience please try again later</string>
<string name="retry">Retry</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
<!-- Others -->
@ -246,11 +257,8 @@
<string name="add_new_account">Add New Account</string>
<string name="Ok"><font fgcolor='#FF8E8E93'>OK</font></string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>


+ 16
- 8
app/src/main/res/values/strings.xml View File

@ -18,7 +18,7 @@
<string name="selectInterestTenure">Select Investment Tenure</string>
<string name="upto0.25">Up to 0.25% p.a for </string>
<string name="upto0.25next">Up to 0.25% p.a for Senior Citizens, 60+</string>
<string name="maturityInstructions">Maturity Instructions:</string>
<string name="maturityInstructions">Maturity Instructions</string>
<string name="additionalDetailOne">Automatically credit to my bank account</string>
<string name="additionalDetailTwo">Automatically renew principal amount</string>
<string name="additionalDetailThree">Automatically renew both principal and interest amount</string>
@ -44,13 +44,16 @@
<string name="minMaxValidation">Min. 12 months, Max. 60 months</string>
<string name="minAmountCategory">MINAmount</string>
<string name="MaxAmountCategory">MAXAmount</string>
<string name="totalDeduction">Total</string>
<string name="principalDeduction">Principal</string>
<!-- Validations -->
<string name="emptyAmount">Please enter amount</string>
<string name="emptyAmountFirst">Please enter amount first</string>
<string name="validMinAmount">Entered amount should be greater than minimum amount</string>
<string name="validMaxAmount">Entered amount should be less than 5 Cr.</string>
<string name="validMaxAmount">Entered amount should be up to 5 Cr only</string>
<string name="validMultipleAmount">Entered Amount should be multiples of 1000</string>
<string name="emptyInterestPayout">Please select Interest Payout</string>
<string name="emptyInterestTenure">Please select Investment Tenure</string>
@ -137,9 +140,12 @@
<string name="inValidMobileNumber">Mobile number should have at least 10 digits</string>
<string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string>
<string name="emptyDOB">Please select date of birth</string>
<string name="minorApplicant">Primary Applicant should not be minor</string>
<string name="emptyPAN">Please enter PAN number</string>
<string name="invalidPAN">Invalid PAN</string>
<string name="invalidPAN">Please enter valid PAN number</string>
<string name="invalidIndividualPAN">PAN Applicants should be individual</string>
<string name="accountVerified">Account Verified</string>
@ -209,6 +215,10 @@
<string name="addPhoto">Add Photo!</string>
<string name="cancel">Cancel</string>
<string name="aadhar">Aadhar</string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<!-- Step Four -->
<string name="makePayment">Make Payment</string>
@ -231,6 +241,7 @@
<string name="TransactionIsUnsuccessful">Your transaction is unsuccessful.</string>
<string name="tryAgainLater">Sorry for the inconvenience please try again later</string>
<string name="retry">Retry</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
<!-- Others -->
@ -246,11 +257,8 @@
<string name="add_new_account">Add New Account</string>
<string name="Ok"><font fgcolor='#FF8E8E93'>OK</font></string>
<string name="cameraPermission">You Need to Give Permission of Camera for uploading Image</string>
<string name="galleryPermission">You Need to Give Permission of Gallery for uploading Image</string>
<string name="permissionRequired">Permission Required !</string>
<string name="permissionsRequired">Permission\'s Required !</string>
<string name="validTermsCondition"><![CDATA[Please select at least one Term & Condition.]]></string>
</resources>

+ 2
- 2
app/src/main/res/values/themes.xml View File

@ -16,10 +16,10 @@
<style name="SCBSwitch" parent="Theme.AppCompat.Light">
<!-- active thumb & track color (30% transparency) -->
<item name="colorControlActivated">@color/red</item>
<item name="colorControlActivated">@color/green</item>
<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">@color/red</item>
<item name="colorSwitchThumbNormal">@color/white</item>
<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#C68D8D</item>


Loading…
Cancel
Save

Powered by TurnKey Linux.