Skip to content

Instantly share code, notes, and snippets.

@hitherejoe hitherejoe/result.kt Secret
Last active Jan 2, 2019

Embed
What would you like to do?
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
LOAD_PAYMENT_DATA_REQUEST_CODE -> when (resultCode) {
Activity.RESULT_OK -> {
data?.let {
val paymentData = PaymentData.getFromIntent(it)
paymentData?.let { data ->
val json = data.toJson()
val paymentMethodData = JSONObject(json)
.getJSONObject("paymentMethodData")
val paymentToken = paymentMethodData
.getJSONObject("tokenizationData")
.getString("token")
}
}
}
Activity.RESULT_CANCELED -> {
// handle cancelled state
}
AutoResolveHelper.RESULT_ERROR -> {
val status = AutoResolveHelper.getStatusFromIntent(data)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.