Browse Source

added missing code

PankajBranch
Hemant Khadase 2 years ago
parent
commit
247f186183
9 changed files with 209 additions and 19 deletions
  1. +6
    -4
      app/src/main/AndroidManifest.xml
  2. +1
    -1
      app/src/main/java/com/nivesh/production/niveshfd/adapter/HorizontalRecyclerViewAdapter.kt
  3. +187
    -0
      app/src/main/java/com/nivesh/production/niveshfd/ui/activity/PaymentActivity.kt
  4. +1
    -0
      app/src/main/java/com/nivesh/production/niveshfd/util/Constants.kt
  5. +0
    -0
      app/src/main/res/drawable/rounded_corner_with_line1.xml
  6. +2
    -2
      app/src/main/res/layout/fragment_niveshfd_step_one.xml
  7. +1
    -1
      app/src/main/res/layout/fragment_niveshfd_step_three.xml
  8. +10
    -10
      app/src/main/res/layout/fragment_niveshfd_step_two.xml
  9. +1
    -1
      app/src/main/res/layout/row_bank_list.xml

+ 6
- 4
app/src/main/AndroidManifest.xml View File

@ -42,11 +42,13 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity> </activity>
<activity
android:name="com.nivesh.production.niveshfd.ui.activity.PaymentActivity"
android:exported="true"
android:label="@string/appName"
android:theme="@style/Theme.NiveshFDSDK"
android:windowSoftInputMode="adjustPan"/>
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"


+ 1
- 1
app/src/main/java/com/nivesh/production/niveshfd/adapter/HorizontalRecyclerViewAdapter.kt View File

@ -70,7 +70,7 @@ class HorizontalRecyclerViewAdapter(
holder.txtYear.background = holder.txtYear.background =
ResourcesCompat.getDrawable( ResourcesCompat.getDrawable(
activity.resources, activity.resources,
R.drawable.rounded_corner_with_line,
R.drawable.rounded_corner_with_line1,
null null
) )
holder.txtYear.setTextColor( holder.txtYear.setTextColor(


+ 187
- 0
app/src/main/java/com/nivesh/production/niveshfd/ui/activity/PaymentActivity.kt View File

@ -0,0 +1,187 @@
package com.nivesh.production.niveshfd.ui.activity
import android.app.Dialog
import android.graphics.Bitmap
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.core.content.ContextCompat
import androidx.lifecycle.ViewModelProvider
import com.google.gson.Gson
import com.nivesh.production.niveshfd.R
import com.nivesh.production.niveshfd.api.ApiClient
import com.nivesh.production.niveshfd.databinding.FragmentNiveshfdStepFiveBinding
import com.nivesh.production.niveshfd.db.PreferenceManager
import com.nivesh.production.niveshfd.model.PaymentReQueryRequest
import com.nivesh.production.niveshfd.model.PaymentReQueryResponse
import com.nivesh.production.niveshfd.repositories.MainRepository
import com.nivesh.production.niveshfd.ui.providerfactory.FDModelProviderFactory
import com.nivesh.production.niveshfd.util.Common
import com.nivesh.production.niveshfd.util.Constants
import com.nivesh.production.niveshfd.util.ProgressUtil
import com.nivesh.production.niveshfd.util.Resource
import com.nivesh.production.niveshfd.viewModel.BajajFDViewModel
class PaymentActivity : BaseActivity() {
lateinit var binding: FragmentNiveshfdStepFiveBinding
var dialogWebView: Dialog? = null
lateinit var viewModel: BajajFDViewModel
var clientCode : String = ""
var uniqueId : String = ""
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel = ViewModelProvider(
this@PaymentActivity,
FDModelProviderFactory(MainRepository(ApiClient.getApiClient))
)[BajajFDViewModel::class.java]
binding = FragmentNiveshfdStepFiveBinding.inflate(layoutInflater)
binding.btnViewOrder.setOnClickListener {
(this@PaymentActivity).setResult(RESULT_OK)
(this@PaymentActivity).finish()
}
binding.tvRetry.setOnClickListener {
(this@PaymentActivity).setResult(RESULT_OK)
(this@PaymentActivity).finish()
}
if (intent != null){
clientCode = intent.getStringExtra("clientCode").toString()
paymentDialog(intent.getStringExtra("url").toString(), intent.getStringExtra("value").toString())
}
}
fun paymentDialog(payUrl: String, value: String) {
Log.e("payUrl", "-->$payUrl")
Log.e("value", "-->$value")
dialogWebView = Dialog(this@PaymentActivity)
dialogWebView!!.setContentView(R.layout.row_fd_pay1)
dialogWebView!!.setCancelable(true)
val tvCancel = dialogWebView!!.findViewById<TextView>(R.id.tvCancel)
tvCancel.setOnClickListener {
dialogWebView!!.dismiss()
(this@PaymentActivity).setResult(RESULT_OK)
(this@PaymentActivity).finish()
}
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(Constants.paymentUrl)) {
if (dialogWebView!!.isShowing) {
dialogWebView!!.dismiss()
paymentReQueryApi()
}
}
}
}
dialogWebView!!.show()
}
fun paymentReQueryApi() {
if (Common.isNetworkAvailable(this)) {
val paymentReQueryRequest = PaymentReQueryRequest()
paymentReQueryRequest.UniqueId = uniqueId
paymentReQueryRequest.NiveshClientCode = clientCode
ProgressUtil.showLoading(this@PaymentActivity)
viewModel.getPaymentReQuery(
paymentReQueryRequest,
PreferenceManager(this@PaymentActivity).getToken(),
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 -> {
getData(paymentReQueryResponse)
}
}
}
}
is Resource.Error -> {
response.message?.let { message ->
Common.showDialogValidation(this@PaymentActivity, message)
}
}
is Resource.Loading -> {
ProgressUtil.hideLoading()
}
is Resource.DataError -> {
}
else -> {
Common.showDialogValidation(this@PaymentActivity, response.message)
}
}
}
}
}
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(
this@PaymentActivity,
R.color.green
)
)
binding.tvSuccessMessage.text = arrOfStr[1]
}
} else {
if (paymentReQueryResponse.Response.Message.isNotEmpty()) {
if (paymentReQueryResponse.Response.Message.isNotEmpty()) {
binding.tvCongrats.text = paymentReQueryResponse.Response.Status
binding.tvCongrats.setTextColor(
ContextCompat.getColor(
this@PaymentActivity,
R.color.red
)
)
binding.tvSuccessMessage.text = paymentReQueryResponse.Response.Message
}
}
binding.tvRetry.visibility = View.VISIBLE
binding.btnViewOrder.visibility = View.GONE
}
}
}

+ 1
- 0
app/src/main/java/com/nivesh/production/niveshfd/util/Constants.kt View File

@ -5,5 +5,6 @@ class Constants() {
companion object { companion object {
const val BASE_URL = "https://providential.in/WebApi_Bajaj/api/" const val BASE_URL = "https://providential.in/WebApi_Bajaj/api/"
// const val token = "636F8F63-06C4-4D95-8562-392B34025FB0" // const val token = "636F8F63-06C4-4D95-8562-392B34025FB0"
const val paymentUrl = "https://uat.nivesh.com/bajajFD/OrderStatus"
} }
} }

app/src/main/res/drawable/rounded_corner_with_line.xml → app/src/main/res/drawable/rounded_corner_with_line1.xml View File


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

@ -103,7 +103,7 @@
android:id="@+id/spInterestPayout" android:id="@+id/spInterestPayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectInterestPayout" android:hint="@string/selectInterestPayout"
android:inputType="none" android:inputType="none"
android:padding="@dimen/margin_10" android:padding="@dimen/margin_10"
@ -127,7 +127,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/margin_10" android:padding="@dimen/margin_10"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectInterestTenure" android:hint="@string/selectInterestTenure"
android:inputType="none" android:inputType="none"
android:labelFor="@+id/spInterestTenure" android:labelFor="@+id/spInterestTenure"


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

@ -190,7 +190,7 @@
android:id="@+id/spDocType" android:id="@+id/spDocType"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/addressProofType" android:hint="@string/addressProofType"
android:inputType="none" android:inputType="none"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"


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

@ -196,7 +196,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectTitle" android:hint="@string/selectTitle"
android:inputType="none" android:inputType="none"
android:labelFor="@+id/spInterestPayout" android:labelFor="@+id/spInterestPayout"
@ -222,7 +222,7 @@
android:id="@+id/spGender" android:id="@+id/spGender"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectGender" android:hint="@string/selectGender"
android:inputType="none" android:inputType="none"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
@ -310,7 +310,7 @@
android:id="@+id/spOccupation" android:id="@+id/spOccupation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/enterOccupation" android:hint="@string/enterOccupation"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -335,7 +335,7 @@
android:id="@+id/spIncome" android:id="@+id/spIncome"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectIncome" android:hint="@string/selectIncome"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -383,7 +383,7 @@
android:id="@+id/spMarital" android:id="@+id/spMarital"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectMaritalStatus" android:hint="@string/selectMaritalStatus"
android:inputType="none" android:inputType="none"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
@ -488,7 +488,7 @@
android:id="@+id/spState" android:id="@+id/spState"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectState" android:hint="@string/selectState"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -513,7 +513,7 @@
android:id="@+id/spCity" android:id="@+id/spCity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectCity" android:hint="@string/selectCity"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -586,7 +586,7 @@
android:id="@+id/spNomineeTitle" android:id="@+id/spNomineeTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectTitle" android:hint="@string/selectTitle"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -695,7 +695,7 @@
android:id="@+id/spNomineeRelation" android:id="@+id/spNomineeRelation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectRelation" android:hint="@string/selectRelation"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"
@ -766,7 +766,7 @@
android:id="@+id/spGuardianRelation" android:id="@+id/spGuardianRelation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:hint="@string/selectRelation" android:hint="@string/selectRelation"
android:padding="@dimen/margin_5" android:padding="@dimen/margin_5"
android:inputType="none" android:inputType="none"


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

@ -6,7 +6,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:background="@drawable/rounded_corner_with_line"
android:background="@drawable/rounded_corner_with_line1"
android:id="@+id/txtYear" android:id="@+id/txtYear"
android:padding="@dimen/margin_10" android:padding="@dimen/margin_10"
android:layout_width="match_parent" android:layout_width="match_parent"


Loading…
Cancel
Save

Powered by TurnKey Linux.