use of com.braintreepayments.api.dropin.DropInResult in project braintree_android by braintree.
the class MainActivity method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == DROP_IN_REQUEST) {
DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
displayNonce(result.getPaymentMethodNonce(), result.getDeviceData());
} else {
Parcelable returnedData = data.getParcelableExtra(EXTRA_PAYMENT_RESULT);
String deviceData = data.getStringExtra(EXTRA_DEVICE_DATA);
if (returnedData instanceof PaymentMethodNonce) {
displayNonce((PaymentMethodNonce) returnedData, deviceData);
} else if (returnedData instanceof BraintreePaymentResult) {
displayBraintreeResult((BraintreePaymentResult) returnedData);
}
mCreateTransactionButton.setEnabled(true);
}
} else if (resultCode != RESULT_CANCELED) {
showDialog(((Exception) data.getSerializableExtra(DropInActivity.EXTRA_ERROR)).getMessage());
}
}
Aggregations