diff --git a/example/src/main/java/io/radar/example/MainActivity.kt b/example/src/main/java/io/radar/example/MainActivity.kt index a10878ce..a836c6ba 100644 --- a/example/src/main/java/io/radar/example/MainActivity.kt +++ b/example/src/main/java/io/radar/example/MainActivity.kt @@ -107,12 +107,6 @@ class MainActivity : AppCompatActivity() { } } - createButton("trackVerified") { - Radar.trackVerified(false) { status, token -> - Log.v("example", "TrackVerified: status = $status; token = ${token?.toJson()}") - } - } - createButton("startTrackingVerified") { Radar.startTrackingVerified(60, false) } diff --git a/sdk/build.gradle b/sdk/build.gradle index 9d53ac87..d9615196 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -10,7 +10,7 @@ apply plugin: "org.jetbrains.dokka" apply plugin: 'io.radar.mvnpublish' ext { - radarVersion = '3.18.9' + radarVersion = '3.18.10' } String buildNumber = ".${System.currentTimeMillis()}" diff --git a/sdk/src/main/java/io/radar/sdk/model/RadarVerifiedLocationToken.kt b/sdk/src/main/java/io/radar/sdk/model/RadarVerifiedLocationToken.kt index 36779a81..ad62eaca 100644 --- a/sdk/src/main/java/io/radar/sdk/model/RadarVerifiedLocationToken.kt +++ b/sdk/src/main/java/io/radar/sdk/model/RadarVerifiedLocationToken.kt @@ -50,6 +50,11 @@ class RadarVerifiedLocationToken( * The Radar ID of the location check. */ val _id: String, + + /** + * The full JSON value of the token. + */ + val fullJson: JSONObject, ) { internal companion object { private const val FIELD_USER = "user" @@ -71,7 +76,7 @@ class RadarVerifiedLocationToken( val token: String? = obj.optString(FIELD_TOKEN) val expiresAt: Date? = RadarUtils.isoStringToDate(obj.optString(FIELD_EXPIRES_AT)) val expiresIn: Int = obj.optInt(FIELD_EXPIRES_IN) - val passed: Boolean = user?.fraud?.passed == true && user.country?.passed == true && user.state?.passed == true + val passed: Boolean = obj.optBoolean(FIELD_PASSED) val failureReasons = obj.optJSONArray(FIELD_FAILURE_REASONS)?.let { failureReasons -> Array(failureReasons.length()) { failureReasons.optString(it) @@ -83,23 +88,12 @@ class RadarVerifiedLocationToken( return null } - return RadarVerifiedLocationToken(user, events, token, expiresAt, expiresIn, passed, failureReasons, id) + return RadarVerifiedLocationToken(user, events, token, expiresAt, expiresIn, passed, failureReasons, id, obj) } } fun toJson(): JSONObject { - val obj = JSONObject() - obj.putOpt(FIELD_USER, this.user.toJson()) - obj.putOpt(FIELD_EVENTS, RadarEvent.toJson(this.events)) - obj.putOpt(FIELD_TOKEN, this.token) - obj.putOpt(FIELD_EXPIRES_AT, RadarUtils.dateToISOString(this.expiresAt)) - obj.putOpt(FIELD_EXPIRES_IN, this.expiresIn) - obj.putOpt(FIELD_PASSED, this.passed) - val failureReasonsArr = JSONArray() - this.failureReasons.forEach { failureReason -> failureReasonsArr.put(failureReason) } - obj.putOpt(FIELD_FAILURE_REASONS, failureReasonsArr) - obj.putOpt(FIELD_ID, this._id) - return obj + return fullJson } } \ No newline at end of file