Skip to content

Commit

Permalink
Add requires user authentication to lookup (braintree#418)
Browse files Browse the repository at this point in the history
* Add `requiresUserAuthentication` method to `ThreeDSecureLookup`
  • Loading branch information
tmartinak authored and GitHub Enterprise committed Sep 25, 2019
1 parent 0c91788 commit f0d8d96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f0d8d96

Please sign in to comment.