Skip to content

fix: Check unverified user with error source #2308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const val PAYMENT_MODE_PAYPAL = "paypal"
const val PAYMENT_MODE_STRIPE = "stripe"
private const val ERRORS = "errors"
private const val DETAIL = "detail"
private const val UNVERIFIED_USER = "unverified user"
private const val UNVERIFIED_USER = "unverified-user"
private const val ORDER_EXPIRY_TIME = 15

class AttendeeViewModel(
Expand Down Expand Up @@ -169,7 +169,7 @@ class AttendeeViewModel(
orderIdentifier = it.identifier.toString()
}, {
if (it is HttpException) {
if (ErrorUtils.getErrorDetails(it).detail?.contains(UNVERIFIED_USER, true) == true) {
if (ErrorUtils.getErrorDetails(it).code == UNVERIFIED_USER) {
mutableRedirectToProfile.value = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Error {
var title: String? = null
var detail: String? = null
var pointer: String? = null
var code: String? = null

override fun toString(): String {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const val SOURCE = "source"
const val POINTER = "pointer"
const val DETAIL = "detail"
const val TITLE = "title"
const val CODE = "code"

const val POINTER_LENGTH = 3

Expand Down Expand Up @@ -62,6 +63,7 @@ object ErrorUtils {
} else {
error.pointer = pointedField
error.detail = jsonArray.get(DETAIL).toString().replace(".", "")
error.code = errorSource.get(CODE).toString()
}
} catch (e: Exception) {
error.detail = jsonArray.get(DETAIL).toString()
Expand Down Expand Up @@ -91,6 +93,7 @@ object ErrorUtils {
} else {
error.pointer = pointedField
error.detail = jsonArray.get(DETAIL).toString().replace(".", "")
error.code = errorSource.get(CODE).toString()
}
error.title = jsonArray.get(TITLE).toString()
} catch (e: Exception) {
Expand Down