From 38895810801384aefe2425c2b1a065f6481bbef7 Mon Sep 17 00:00:00 2001 From: Matthias Leitner Date: Mon, 9 Oct 2017 22:15:27 +0200 Subject: [PATCH] ENHANCEMENT handle cancel event --- .../src/main/java/com/pw/droplet/braintree/Braintree.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/pw/droplet/braintree/Braintree.java b/android/src/main/java/com/pw/droplet/braintree/Braintree.java index ccdb78bb..fe2e4e32 100644 --- a/android/src/main/java/com/pw/droplet/braintree/Braintree.java +++ b/android/src/main/java/com/pw/droplet/braintree/Braintree.java @@ -21,7 +21,7 @@ import com.braintreepayments.api.PayPal; import com.braintreepayments.api.interfaces.PaymentMethodNonceCreatedListener; import com.braintreepayments.api.interfaces.BraintreeErrorListener; - +import com.braintreepayments.api.interfaces.BraintreeCancelListener; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; @@ -68,6 +68,12 @@ public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) { nonceCallback(paymentMethodNonce.getNonce()); } }); + this.mBraintreeFragment.addListener(new BraintreeCancelListener() { + @Override + public void onCancel(int requestCode){ + nonceErrorCallback("REQUEST_CANCELED"); + } + }); this.mBraintreeFragment.addListener(new BraintreeErrorListener() { @Override public void onError(Exception error) {