AA-24 | Shashidhara | WIP: API integration

This commit is contained in:
Shashidhara Gopal
2019-11-14 16:07:05 +05:30
parent 3c246b0bd9
commit ecbe874c71
12 changed files with 31 additions and 24 deletions

View File

@@ -7,11 +7,13 @@ import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.Path
private const val BASE_URL = "https://auth-service.np.navi-tech.in"
//private const val BASE_URL = "https://auth-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
interface InputPanApi {
@PATCH("/party/persons/:id/POI")
@PATCH("/loan-origination-manager/loan-applications/{loan-application-id}/POI")
suspend fun submitPan(@Body inputPanRequest: InputPanRequest): Response<InputPanResponse>
companion object {

View File

@@ -9,7 +9,8 @@ import com.navi.medici.androidCustomerApp.models.response.OfferAcceptResponse
import retrofit2.Response
import retrofit2.http.*
private const val BASE_URL = "https://loan-origination-service.np.navi-tech.in"
//private const val BASE_URL = "https://loan-origination-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
//private const val BASE_URL = "http://192.168.31.220:3020"
interface LoanApplicationApi {
@PUT("/los/apply-loan")

View File

@@ -7,7 +7,8 @@ import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
private const val BASE_URL = "https://auth-service.np.navi-tech.in"
//private const val BASE_URL = "https://auth-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
//private const val BASE_URL = "http://192.168.31.220:3020"
interface LoginApi {

View File

@@ -6,7 +6,8 @@ import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query
private const val BASE_URL = "https://loan-accounts-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
//private const val BASE_URL = "https://loan-accounts-service.np.navi-tech.in"
//private const val BASE_URL = "http://192.168.31.220:3020"
interface MyLoansApi {

View File

@@ -7,7 +7,8 @@ import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.POST
private const val BASE_URL = "https://auth-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
//private const val BASE_URL = "https://auth-service.np.navi-tech.in"
//private const val BASE_URL = "http://192.168.31.220:3020"
interface OtpApi {

View File

@@ -7,8 +7,10 @@ import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.PUT
private const val BASE_URL = "https://auth-service.np.navi-tech.in"
//private const val BASE_URL = "https://auth-service.np.navi-tech.in"
//private const val BASE_URL = "http://192.168.31.220:3020"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
interface RegisterApi {
@PUT("/auth/app-installations/register")
suspend fun checkDevice(@Body registerRequest: RegisterRequest): Response<RegisterResponse>
@@ -16,7 +18,8 @@ interface RegisterApi {
companion object {
operator fun invoke(): RegisterApi {
return RetrofitService.build(BASE_URL).create(
RegisterApi::class.java)
RegisterApi::class.java
)
}
}
}

View File

@@ -9,7 +9,8 @@ import retrofit2.http.POST
import retrofit2.http.Part
import okhttp3.MultipartBody
private const val BASE_URL = "https://auth-service.np.navi-tech.in"
private const val BASE_URL = "https://5ab1dd15-c349-4724-8da6-45c72a7d7219.mock.pstmn.io"
//private const val BASE_URL = "https://auth-service.np.navi-tech.in"
interface UploadPanApi {
@Multipart

View File

@@ -2,6 +2,8 @@ package com.navi.medici.androidCustomerApp.preferences
import android.app.Activity
import android.content.Context
import android.content.SharedPreferences
import com.navi.medici.androidCustomerApp.preferences.PreferenceWrapper.PREFS_FILENAME
object PreferenceManager {
fun getPersonId(context: Context): String? {

View File

@@ -3,7 +3,7 @@ package com.navi.medici.androidCustomerApp.repositories
import com.navi.medici.androidCustomerApp.api.RegisterApi
import com.navi.medici.androidCustomerApp.models.request.RegisterRequest
class RegisterRepository(private val launchApi: RegisterApi) {
class RegisterRepository(private val registerApi: RegisterApi) {
suspend fun checkDevice(registerRequest: RegisterRequest) =
suspend { launchApi.checkDevice(registerRequest) }.invoke()
suspend { registerApi.checkDevice(registerRequest) }.invoke()
}

View File

@@ -54,13 +54,12 @@ class SplashScreenActivity : AppCompatActivity() {
@SuppressLint("MissingPermission")
private fun getImei(): String {
return "12121212232323"
// val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
// return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// telephonyManager.imei
// } else {
// telephonyManager.deviceId
// }
val telephonyManager = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
telephonyManager.imei
} else {
telephonyManager.deviceId
}
}
override fun onRequestPermissionsResult(

View File

@@ -21,11 +21,7 @@ class InputPanViewModel : ViewModel() {
val inputPanRequest = InputPanRequest(pan)
coroutineScope.launch {
val response = inputPanRepository.submitPan(inputPanRequest)
if (response.isSuccessful) {
_panSubmitted.value = true
} else {
_panSubmitted.value = false
}
_panSubmitted.value = response.isSuccessful
}
}

View File

@@ -28,7 +28,7 @@ class SplashScreenViewModel : ViewModel() {
}
}
companion object {
private companion object {
private const val CHANNEL_ID: String = "android"
}
}