Commit f0e967b0 authored by yinjiacheng's avatar yinjiacheng

add 企业认证相关接口 个人认证身份信息校验错误提示

parent a474415c
...@@ -37,5 +37,11 @@ class URLs { ...@@ -37,5 +37,11 @@ class URLs {
const val authLiveIdentity = "/merchant/auth/live_identity" const val authLiveIdentity = "/merchant/auth/live_identity"
const val authComplete = "/merchant/auth/complete" const val authComplete = "/merchant/auth/complete"
const val authAuthentication = "/merchant/auth/authentication" const val authAuthentication = "/merchant/auth/authentication"
const val authMerchantCheck = "/merchant/enterprise/ent_check"
const val authBusinessLicenseCommit = "/merchant/enterprise/ent_commit"
const val authEnterpriseLegalIdentityCommit = "/merchant/enterprise/legal_commit"
const val authIndividualBusinessIdentityCommit = "/merchant/enterprise/ent_personal"
const val authEnterpriseLiveIdentity = "/merchant/enterprise/live_identity"
const val authEnterpriseComplete = "/merchant/enterprise/complete"
} }
} }
\ No newline at end of file
...@@ -42,6 +42,6 @@ object Constant { ...@@ -42,6 +42,6 @@ object Constant {
const val TYPE_RAW_IMAGE = "raw_image" // 不进行活体验证,仅使用上传的图片进行后续的比对 const val TYPE_RAW_IMAGE = "raw_image" // 不进行活体验证,仅使用上传的图片进行后续的比对
// 服务端error message // 服务端error message
const val error_message_id_card_number = "身份证号码有误" const val ERROR_MESSAGE_ID_CARD_NUMBER = "身份证号码有误"
const val error_message_real_name = "姓名缺失" const val ERROR_MESSAGE_REAL_NAME = "姓名缺失"
} }
\ No newline at end of file
...@@ -7,10 +7,7 @@ import com.yidian.common.http.TransformUtil ...@@ -7,10 +7,7 @@ import com.yidian.common.http.TransformUtil
import com.yidian.http.ServiceFactory import com.yidian.http.ServiceFactory
import com.yidian.shenghuoquan.newscontent.bean.CreateLifeAccountBean import com.yidian.shenghuoquan.newscontent.bean.CreateLifeAccountBean
import com.yidian.shenghuoquan.newscontent.bean.ICreateLifeAccountCallback import com.yidian.shenghuoquan.newscontent.bean.ICreateLifeAccountCallback
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthAuthenticationCallback import com.yidian.shenghuoquan.newscontent.http.callback.*
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthCompleteCallback
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthLiveIdentityCallback
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthPersonalCheckCallback
import com.yidian.shenghuoquan.newscontent.http.httpbean.* import com.yidian.shenghuoquan.newscontent.http.httpbean.*
import okhttp3.MultipartBody import okhttp3.MultipartBody
...@@ -297,5 +294,107 @@ class ApiService { ...@@ -297,5 +294,107 @@ class ApiService {
} }
}) })
} }
// 401 商户认证检查
fun authMerchantCheck(apiCallback: IAuthMerchantCheckCallback, requestParams: Map<String, String>) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authMerchantCheck(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<AuthMerchantCheckBean.Response>() {
override fun onSuccess(result: HttpResult<AuthMerchantCheckBean.Response>?) {
apiCallback.authMerchantCheckSuccess(result?.result)
}
override fun onFailer(result: HttpResult<AuthMerchantCheckBean.Response>?) {
apiCallback.authMerchantCheckFailure(result?.reason)
}
})
}
// 402 商户上传营业执照信息
fun authBusinessLicenseCommit(apiCallback: IAuthBusinessLicenseCommitCallback, requestParams: AuthBusinessLicenseCommitBean.Request) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authBusinessLicenseCommit(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<AuthBusinessLicenseCommitBean.Response>() {
override fun onSuccess(result: HttpResult<AuthBusinessLicenseCommitBean.Response>?) {
apiCallback.authBusinessLicenseCommitSuccess(result?.result)
}
override fun onFailer(result: HttpResult<AuthBusinessLicenseCommitBean.Response>?) {
apiCallback.authBusinessLicenseCommitFailure(result?.reason)
}
})
}
// 403 普通企业上传法人身份信息
fun authEnterpriseLegalIdentityCommit(apiCallback: IAuthEnterpriseLegalIdentityCommitCallback, requestParams: AuthEnterpriseLegalIdentityCommitBean.Request) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authEnterpriseLegalIdentityCommit(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<Any>() {
override fun onSuccess(result: HttpResult<Any>?) {
apiCallback.authEnterpriseLegalIdentityCommitSuccess()
}
override fun onFailer(result: HttpResult<Any>?) {
apiCallback.authEnterpriseLegalIdentityCommitFailure(result?.reason)
}
})
}
// 404 个体工商户身份认证
fun authIndividualBusinessIdentityCommit(apiCallback: IAuthIndividualBusinessIdentityCommitCallback, requestParams: AuthIndividualBusinessIdentityCommitBean.Request) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authIndividualBusinessIdentityCommit(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<Any>() {
override fun onSuccess(result: HttpResult<Any>?) {
apiCallback.authIndividualBusinessIdentityCommitSuccess()
}
override fun onFailer(result: HttpResult<Any>?) {
apiCallback.authIndividualBusinessIdentityCommitFailure(result?.reason)
}
})
}
// 405 活体识别成功后回调接口
fun authEnterpriseLiveIdentity(apiCallback: IAuthEnterpriseLiveIdentityCallback, requestParams: Map<String, String>) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authEnterpriseLiveIdentity(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<Any>() {
override fun onSuccess(result: HttpResult<Any>?) {
apiCallback.authEnterpriseLiveIdentitySuccess()
}
override fun onFailer(result: HttpResult<Any>?) {
apiCallback.authEnterpriseLiveIdentityFailure(result?.reason)
}
})
}
// 410 企业认证完成认证
fun authEnterpriseComplete(apiCallback: IAuthEnterpriseCompleteCallback, requestParams: Map<String, String>) {
val paramsMap = HttpParamsUtils.getParamsMap()
ServiceFactory.getInstance().createService(CommonService::class.java)
.authEnterpriseComplete(paramsMap, requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<AuthEnterpriseCompleteBean.Response>() {
override fun onSuccess(result: HttpResult<AuthEnterpriseCompleteBean.Response>?) {
apiCallback.authEnterpriseCompleteSuccess(result?.result)
}
override fun onFailer(result: HttpResult<AuthEnterpriseCompleteBean.Response>?) {
apiCallback.authEnterpriseCompleteFailure(result?.reason)
}
})
}
} }
} }
...@@ -72,4 +72,26 @@ interface CommonService { ...@@ -72,4 +72,26 @@ interface CommonService {
@GET(URLs.authAuthentication) @GET(URLs.authAuthentication)
fun authAuthentication(@QueryMap commonParams: Map<String, String>): Observable<HttpResult<AuthAuthenticationBean.Response>> fun authAuthentication(@QueryMap commonParams: Map<String, String>): Observable<HttpResult<AuthAuthenticationBean.Response>>
@GET(URLs.authMerchantCheck)
fun authMerchantCheck(@QueryMap commonParams: Map<String, String>, @QueryMap requestParams: Map<String, String>) : Observable<HttpResult<AuthMerchantCheckBean.Response>>
@Headers("Content-Type: application/json")
@POST(URLs.authBusinessLicenseCommit)
fun authBusinessLicenseCommit(@QueryMap commonParams: Map<String, String>, @Body requestParams: AuthBusinessLicenseCommitBean.Request) : Observable<HttpResult<AuthBusinessLicenseCommitBean.Response>>
@Headers("Content-Type: application/json")
@POST(URLs.authEnterpriseLegalIdentityCommit)
fun authEnterpriseLegalIdentityCommit(@QueryMap commonParams: Map<String, String>, @Body requestParams: AuthEnterpriseLegalIdentityCommitBean.Request) : Observable<HttpResult<Any>>
@Headers("Content-Type: application/json")
@POST(URLs.authIndividualBusinessIdentityCommit)
fun authIndividualBusinessIdentityCommit(@QueryMap commonParams: Map<String, String>, @Body requestParams: AuthIndividualBusinessIdentityCommitBean.Request) : Observable<HttpResult<Any>>
@GET(URLs.authEnterpriseLiveIdentity)
fun authEnterpriseLiveIdentity(@QueryMap commonParams: Map<String, String>, @QueryMap requestParams: Map<String, String>) : Observable<HttpResult<Any>>
@GET(URLs.authEnterpriseComplete)
fun authEnterpriseComplete(@QueryMap commonParams: Map<String, String>, @QueryMap requestParams: Map<String, String>) : Observable<HttpResult<AuthEnterpriseCompleteBean.Response>>
} }
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthBusinessLicenseCommitBean
/**
* author: yinjiacheng
* date: 6/3/21 7:25 PM
* description: API /merchant/enterprise/ent_commit
*/
interface IAuthBusinessLicenseCommitCallback {
fun authBusinessLicenseCommitSuccess(result: AuthBusinessLicenseCommitBean.Response?)
fun authBusinessLicenseCommitFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthEnterpriseCompleteBean
/**
* author: yinjiacheng
* date: 6/3/21 9:12 PM
* description: API /merchant/enterprise/complete
*/
interface IAuthEnterpriseCompleteCallback {
fun authEnterpriseCompleteSuccess(result: AuthEnterpriseCompleteBean.Response?)
fun authEnterpriseCompleteFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
/**
* author: yinjiacheng
* date: 6/3/21 8:38 PM
* description: API /merchant/enterprise/ent_commit
*/
interface IAuthEnterpriseLegalIdentityCommitCallback {
fun authEnterpriseLegalIdentityCommitSuccess()
fun authEnterpriseLegalIdentityCommitFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
/**
* author: yinjiacheng
* date: 6/3/21 9:06 PM
* description: API /merchant/enterprise/live_identity
*/
interface IAuthEnterpriseLiveIdentityCallback {
fun authEnterpriseLiveIdentitySuccess()
fun authEnterpriseLiveIdentityFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
/**
* author: yinjiacheng
* date: 6/3/21 8:55 PM
* description: API /merchant/enterprise/ent_personal
*/
interface IAuthIndividualBusinessIdentityCommitCallback {
fun authIndividualBusinessIdentityCommitSuccess()
fun authIndividualBusinessIdentityCommitFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.callback
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthMerchantCheckBean
/**
* author: yinjiacheng
* date: 6/3/21 6:21 PM
* description: API /merchant/enterprise/ent_check
*/
interface IAuthMerchantCheckCallback {
fun authMerchantCheckSuccess(result: AuthMerchantCheckBean.Response?)
fun authMerchantCheckFailure(message: String?)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 6:23 PM
* description: API /merchant/enterprise/ent_commit
*/
class AuthBusinessLicenseCommitBean {
data class Request(
val user_id: Long,
val code: String,
val name: String,
val type: String?,
val addr: String?,
val pers: String?,
val scope: String?,
val time: String?,
val regi: String?,
val organizer: String?,
val date: String?,
val comp: String?,
val num: String?,
val form: String?,
val funding: String?,
val issue_date: String?,
val entterprise_image: String,
val data_from: Int,
val data_type: Int,
val life_account_id: Long?,
val proxy_user_name: String?,
val mobile: String?,
val is_agent: Int?
)
data class Response(val data: Int)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 9:08 PM
* description: API /merchant/enterprise/complete
*/
class AuthEnterpriseCompleteBean {
data class Request(val code: String)
data class Response(
val enterprise_auth_record_id: Long,
val code: String,
val name: String,
val legal_person: String,
val legal_id_card: String,
val data_type: Int,
val audit_status: Int
)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 7:37 PM
* description: API /merchant/enterprise/ent_commit
*/
class AuthEnterpriseLegalIdentityCommitBean() {
data class Request(
val record_id: Long,
val front_img: String,
val bak_img: String,
val front_completeness: Int,
val bak_completeness: Int,
val idcard_number: String,
val gender: String?,
val name: String,
val address: String?,
val nationality: String?,
val valid_date_start: String?,
val valid_date_end: String?,
val issued_by: String?,
val life_account_id: Long?,
val proxy_user_name: String?,
val mobile: String,
val is_agent: String?
)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 9:05 PM
* description: API /merchant/enterprise/live_identity
*/
class AuthEnterpriseLiveIdentityBean {
data class Request(val code: String, val idcard_number: String)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 8:41 PM
* description: API /merchant/enterprise/ent_personal
*/
class AuthIndividualBusinessIdentityCommitBean {
data class Request(
val code: String,
val data_type: Int,
val front_img: String,
val bak_img: String,
val front_completeness: Int,
val bak_completeness: Int,
val idcard_number: String,
val gender: String?,
val name: String,
val address: String?,
val nationality: String?,
val valid_date_start: String?,
val valid_date_end: String?,
val issued_by: String?,
val proxy_user_name: String?,
val phone: String?,
val is_agent: Int?
)
}
\ No newline at end of file
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* author: yinjiacheng
* date: 6/3/21 6:05 PM
* description: API /merchant/enterprise/ent_check
*/
class AuthMerchantCheckBean {
data class Request(
val user_id: Long,
val life_account_id: Long?,
val mobile: String?,
val is_agent: Int?
)
data class Response(val enterprise_auth_record_id: Int)
}
\ No newline at end of file
...@@ -575,6 +575,19 @@ class LifeAccountIDCardAuthFragment : BaseFragment<FragmentLifeAccountIdCardAuth ...@@ -575,6 +575,19 @@ class LifeAccountIDCardAuthFragment : BaseFragment<FragmentLifeAccountIdCardAuth
Constant.LIFE_ACCOUNT_AUTH_TAG, Constant.LIFE_ACCOUNT_AUTH_TAG,
"request auth personal check failure: message: $message" "request auth personal check failure: message: $message"
) )
// 展示错误提示
when (message) {
Constant.ERROR_MESSAGE_REAL_NAME -> {
viewBinding.evRealName.showErrorTips(
resources.getText(R.string.id_card_name_error_tips) as String
)
viewBinding.evRealName.highLightEditContent()
}
Constant.ERROR_MESSAGE_ID_CARD_NUMBER -> {
viewBinding.evIdCardNumber.showErrorTips(resources.getText(R.string.id_card_number_error_tips) as String)
viewBinding.evIdCardNumber.highLightEditContent()
}
}
} }
override fun authLiveIdentitySuccess() { override fun authLiveIdentitySuccess() {
...@@ -622,15 +635,15 @@ class LifeAccountIDCardAuthFragment : BaseFragment<FragmentLifeAccountIdCardAuth ...@@ -622,15 +635,15 @@ class LifeAccountIDCardAuthFragment : BaseFragment<FragmentLifeAccountIdCardAuth
*/ */
private fun changeFaceAuthUI(result: Boolean) { private fun changeFaceAuthUI(result: Boolean) {
if (result) { if (result) {
viewBinding.tvFaceAuthResult.text = activity?.getText(R.string.face_auth_success) viewBinding.tvFaceAuthResult.text = resources.getText(R.string.face_auth_success)
viewBinding.tvFaceAuthResult.setTextColor(Color.parseColor("#FF6BB81F")) viewBinding.tvFaceAuthResult.setTextColor(Color.parseColor("#FF6BB81F"))
viewBinding.ivFaceAuthStart.visibility = View.GONE viewBinding.ivFaceAuthStart.visibility = View.GONE
viewBinding.tvFaceAuthErrorTips.visibility = View.GONE viewBinding.tvFaceAuthErrorTips.visibility = View.GONE
} else { } else {
viewBinding.tvFaceAuthResult.text = activity?.getText(R.string.face_auth_fail) viewBinding.tvFaceAuthResult.text = resources.getText(R.string.face_auth_fail)
viewBinding.tvFaceAuthResult.setTextColor(Color.parseColor("#FFFF3A3A")) viewBinding.tvFaceAuthResult.setTextColor(Color.parseColor("#FFFF3A3A"))
viewBinding.tvFaceAuthErrorTips.visibility = View.VISIBLE viewBinding.tvFaceAuthErrorTips.visibility = View.VISIBLE
viewBinding.tvFaceAuthErrorTips.text = activity?.getText(R.string.face_auth_error_tips) viewBinding.tvFaceAuthErrorTips.text = resources.getText(R.string.face_auth_error_tips)
} }
} }
......
package com.yidian.shenghuoquan.newscontent.widget package com.yidian.shenghuoquan.newscontent.widget
import android.content.Context import android.content.Context
import android.graphics.Color
import android.text.Editable import android.text.Editable
import android.text.TextUtils import android.text.TextUtils
import android.text.TextWatcher import android.text.TextWatcher
...@@ -33,6 +34,11 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor( ...@@ -33,6 +34,11 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor(
private var callback: OnLifeAccountAuthIdentityInfoEditViewCallback? = null private var callback: OnLifeAccountAuthIdentityInfoEditViewCallback? = null
/**
* 是否输入错误标识位
*/
private var isInputError = false
init { init {
val typedArray = val typedArray =
context.obtainStyledAttributes(attrs, R.styleable.LifeAccountAuthIdentityInfoEditView) context.obtainStyledAttributes(attrs, R.styleable.LifeAccountAuthIdentityInfoEditView)
...@@ -53,13 +59,22 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor( ...@@ -53,13 +59,22 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor(
viewBinding.tvErrorTips.text = tips viewBinding.tvErrorTips.text = tips
} }
/**
* 隐藏错误提示
*/
fun dismissErrorTips() {
viewBinding.tvErrorTips.visibility = View.GONE
viewBinding.tvErrorTips.text = ""
}
/** /**
* 清除输入的文字 * 清除输入的文字
*/ */
fun clearEditContent() { fun clearEditContent() {
viewBinding.etContent.setText("") viewBinding.etContent.setText("")
if (viewBinding.tvErrorTips.visibility == View.VISIBLE) { if (isInputError) {
viewBinding.tvErrorTips.visibility = View.GONE dismissErrorTips()
cancelHighLightEditContent()
} }
callback?.onTextClear(this) callback?.onTextClear(this)
} }
...@@ -82,6 +97,22 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor( ...@@ -82,6 +97,22 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor(
isEnabled = false isEnabled = false
} }
/**
* 高亮显示输入文本
*/
fun highLightEditContent() {
isInputError = true
viewBinding.etContent.setTextColor(Color.parseColor("#FFFF3A3A"))
}
/**
* 取消高亮显示输入文本
*/
fun cancelHighLightEditContent() {
isInputError = false
viewBinding.etContent.setTextColor(Color.parseColor("#FF333333"))
}
override fun onClick(v: View?) { override fun onClick(v: View?) {
if (v?.id == R.id.iv_clear) { if (v?.id == R.id.iv_clear) {
// 清除输入框中的内容 // 清除输入框中的内容
...@@ -101,6 +132,10 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor( ...@@ -101,6 +132,10 @@ class LifeAccountAuthIdentityInfoEditView @JvmOverloads constructor(
// 处理一键清除按钮 // 处理一键清除按钮
viewBinding.ivClear.visibility = if (TextUtils.isEmpty(s)) View.GONE else View.VISIBLE viewBinding.ivClear.visibility = if (TextUtils.isEmpty(s)) View.GONE else View.VISIBLE
callback?.onTextChange(this, s.toString()) callback?.onTextChange(this, s.toString())
if (isInputError) {
dismissErrorTips()
cancelHighLightEditContent()
}
} }
fun setOnLifeAccountAuthIdentityInfoEditViewCallback(callback: OnLifeAccountAuthIdentityInfoEditViewCallback) { fun setOnLifeAccountAuthIdentityInfoEditViewCallback(callback: OnLifeAccountAuthIdentityInfoEditViewCallback) {
......
...@@ -92,10 +92,10 @@ ...@@ -92,10 +92,10 @@
<string name="upload_national_emblem_face">点击上传国徽面</string> <string name="upload_national_emblem_face">点击上传国徽面</string>
<string name="real_name">真实姓名</string> <string name="real_name">真实姓名</string>
<string name="input_real_name">请输入真实姓名</string> <string name="input_real_name">请输入真实姓名</string>
<string name="check_id_card_name">请核对证件姓名</string> <string name="id_card_name_error_tips">请核对证件姓名</string>
<string name="id_card_number">证件号码</string> <string name="id_card_number">证件号码</string>
<string name="input_id_card_number">请输入18位身份证号码</string> <string name="input_id_card_number">请输入18位身份证号码</string>
<string name="check_id_card_number">请核对证件号码</string> <string name="id_card_number_error_tips">请核对证件号码</string>
<string name="face_auth">人脸验证</string> <string name="face_auth">人脸验证</string>
<string name="start_face_auth">去验证</string> <string name="start_face_auth">去验证</string>
<string name="face_auth_success">验证通过</string> <string name="face_auth_success">验证通过</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment