Created
March 11, 2017 10:24
-
-
Save KravaDanil/43ed368b57d7595f469246f3509c8fb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getStripeIdToServer(hm: Map<String, String>) = | |
freebirdApi.authStripe(hm) | |
.doOnSubscribe { view?.showProgress() } | |
.doAfterTerminate { view?.hideProgress() } | |
.flatMap { json -> | |
view?.onJsonObjectCallback(json) | |
return@flatMap freebirdApi.addExternalAccount(mapOf(Pair("token", json.getString("access_token")))) | |
} | |
.subscribe({ | |
preferences.setUserInfo(it.user) | |
view?.finishActivity() | |
}, { | |
logError(it) | |
view?.showToast(context.getString(R.string.default_error)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment