diff --git a/Braintree/src/main/java/com/braintreepayments/api/models/ThreeDSecureLookup.java b/Braintree/src/main/java/com/braintreepayments/api/models/ThreeDSecureLookup.java index 847e014be6..ac5fa598d1 100644 --- a/Braintree/src/main/java/com/braintreepayments/api/models/ThreeDSecureLookup.java +++ b/Braintree/src/main/java/com/braintreepayments/api/models/ThreeDSecureLookup.java @@ -3,6 +3,7 @@ import android.os.Parcel; import android.os.Parcelable; +import com.braintreepayments.api.BraintreeFragment; import com.braintreepayments.api.Json; import org.json.JSONException; @@ -116,6 +117,15 @@ public String getTransactionId() { return mTransactionId; } + /** + * @return {@code boolean} + * When `true`, the user will be presented with a 3D Secure challenge when calling + * {@link com.braintreepayments.api.ThreeDSecure#continuePerformVerification(BraintreeFragment, ThreeDSecureRequest, ThreeDSecureLookup)} + */ + public boolean requiresUserAuthentication() { + return mAcsUrl != null; + } + public ThreeDSecureLookup() {} @Override diff --git a/Braintree/src/test/java/com/braintreepayments/api/models/ThreeDSecureLookupUnitTest.java b/Braintree/src/test/java/com/braintreepayments/api/models/ThreeDSecureLookupUnitTest.java index 5a47bb5e6a..a42555a888 100644 --- a/Braintree/src/test/java/com/braintreepayments/api/models/ThreeDSecureLookupUnitTest.java +++ b/Braintree/src/test/java/com/braintreepayments/api/models/ThreeDSecureLookupUnitTest.java @@ -12,6 +12,7 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertFalse; @RunWith(RobolectricTestRunner.class) public class ThreeDSecureLookupUnitTest { @@ -42,6 +43,7 @@ public void fromJson_parsesCorrectly() { assertTrue(mLookupWithoutVersion.getCardNonce().getThreeDSecureInfo().isLiabilityShifted()); assertTrue(mLookupWithoutVersion.getCardNonce().getThreeDSecureInfo().isLiabilityShiftPossible()); assertTrue(mLookupWithoutVersion.getCardNonce().getThreeDSecureInfo().wasVerified()); + assertTrue(mLookupWithoutVersion.requiresUserAuthentication()); } @Test @@ -85,6 +87,7 @@ public void fromJson_whenNoAcsURL_parsesCorrectly() { assertTrue(mLookupWithoutAcsURL.getCardNonce().getThreeDSecureInfo().isLiabilityShifted()); assertTrue(mLookupWithoutAcsURL.getCardNonce().getThreeDSecureInfo().isLiabilityShiftPossible()); assertTrue(mLookupWithoutAcsURL.getCardNonce().getThreeDSecureInfo().wasVerified()); + assertFalse(mLookupWithoutAcsURL.requiresUserAuthentication()); } @Test diff --git a/CHANGELOG.md b/CHANGELOG.md index 343a7d7aac..13ae31e15d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Add ability to request `AuthenticationInsight` when tokenizing a credit card, which can be used to make a decision about whether to perform 3D Secure verification * Include reference to Cardinal's docs for `uiCustomization` property on `ThreeDSecureRequest`. +* Add `requiresUserAuthentication` method to `ThreeDSecureLookup` ## 3.6.0