Browse Source

retry functionality is done

PankajBranch
Hemant Khadase 2 years ago
parent
commit
531589e577
4 changed files with 25 additions and 22 deletions
  1. +1
    -4
      app/src/main/java/com/nivesh/production/niveshfd/api/ApiCallback.kt
  2. +0
    -6
      app/src/main/java/com/nivesh/production/niveshfd/interfaces/ApiInterface.kt
  3. +7
    -0
      app/src/main/java/com/nivesh/production/niveshfd/ui/activity/NiveshFdMainActivity.kt
  4. +17
    -12
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFiveNiveshFDFragment.kt

+ 1
- 4
app/src/main/java/com/nivesh/production/niveshfd/api/ApiCallback.kt View File

@ -14,15 +14,12 @@ abstract class ApiCallback<T : Any> : Callback<Resource<T>> {
override fun onResponse(call: Call<Resource<T>>, response: Response<Resource<T>>) { override fun onResponse(call: Call<Resource<T>>, response: Response<Resource<T>>) {
if (response.isSuccessful && response.body() != null && response.code() == 200) { if (response.isSuccessful && response.body() != null && response.code() == 200) {
onSuccess(response.body()!!) onSuccess(response.body()!!)
} else {
} else if (response.code() == 650){
// handle 4xx & 5xx error codes here // handle 4xx & 5xx error codes here
// val resp = Resource<T>() // val resp = Resource<T>()
// resp.status = false // resp.status = false
// resp.message = response.message() // resp.message = response.message()
// onFailure(resp) // onFailure(resp)
} }
} }


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

@ -44,12 +44,6 @@ interface ApiInterface {
@Header("token") token: String @Header("token") token: String
): Response<JsonObject> ): Response<JsonObject>
@POST("UpdateFDPaymentStatus")
suspend fun updateFDPaymentStatus(
@Body requestBody: RequestBody,
@Header("token") token: String
): Response<JsonObject>
@POST("FinaliseFD") @POST("FinaliseFD")
suspend fun finaliseFD( suspend fun finaliseFD(
@Body requestBody: FinalizeFDRequest, @Body requestBody: FinalizeFDRequest,


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

@ -2,6 +2,7 @@ package com.nivesh.production.niveshfd.ui.activity
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Dialog import android.app.Dialog
import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Bundle import android.os.Bundle
@ -485,4 +486,10 @@ class NiveshFdMainActivity : BaseActivity() {
} }
} }
fun retryMethod() {
val intent: Intent = getIntent()
finish()
startActivity(intent)
}
} }

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

@ -33,11 +33,13 @@ class StepFiveNiveshFDFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
binding.tvCongrats.text = ""
binding.tvSuccessMessage.text = ""
binding.btnViewOrder.setOnClickListener { binding.btnViewOrder.setOnClickListener {
} }
binding.tvRetry.setOnClickListener{
(activity as NiveshFdMainActivity).retryMethod()
}
} }
fun getData(paymentReQueryResponse: PaymentReQueryResponse) { fun getData(paymentReQueryResponse: PaymentReQueryResponse) {
@ -55,16 +57,21 @@ class StepFiveNiveshFDFragment : Fragment() {
} }
}else{ }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.setTextColor(
ContextCompat.getColor(
activity as NiveshFdMainActivity,
R.color.red
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 NiveshFdMainActivity,
R.color.red
)
) )
)
binding.tvSuccessMessage.text = arrOfStr[1]
binding.tvSuccessMessage.text = arrOfStr[1]
}
} }
binding.tvRetry.visibility = View.VISIBLE
binding.btnViewOrder.visibility = View.GONE
} }
finalizeFDApi() finalizeFDApi()
finalizeKYCApi() finalizeKYCApi()
@ -164,8 +171,6 @@ class StepFiveNiveshFDFragment : Fragment() {
} }
override fun onDestroyView() { override fun onDestroyView() {
super.onDestroyView() super.onDestroyView()
_binding = null _binding = null


Loading…
Cancel
Save

Powered by TurnKey Linux.