Skip to content

Commit

Permalink
Add authentication and lookup transaction status to 3DS info. (braint…
Browse files Browse the repository at this point in the history
…ree#414)

* Add authentication and lookup transaction status to 3DS info.
  • Loading branch information
demerino authored and sestevens committed Sep 5, 2019
1 parent 50963fa commit e89e278
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"countryOfIssuance": "Something",
"productId": "123"
},
"threeDSecureInfo":
{
"threeDSecureInfo": {
"cavv": "fake-cavv",
"dsTransactionId": "fake-txn-id",
"eciFlag": "07",
Expand All @@ -37,7 +36,17 @@
"xid": "fake-xid",
"acsTransactionId": "fake-acs-transaction-id",
"threeDSecureServerTransactionId": "fake-threedsecure-server-transaction-id",
"paresStatus": "fake-pares-status"
"paresStatus": "fake-pares-status",
"authentication":
{
"transStatus": "Y",
"transStatusReason": "01"
},
"lookup":
{
"transStatus": "N",
"transStatusReason": "02"
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public class ThreeDSecureInfo implements Parcelable {
private static final String ACS_TRANSACTION_ID_KEY = "acsTransactionId";
private static final String THREE_D_SECURE_SERVER_TRANSACTION_ID_KEY = "threeDSecureServerTransactionId";
private static final String PARES_STATUS_KEY= "paresStatus";
private static final String AUTHENTICATION_KEY= "authentication";
private static final String LOOKUP_KEY= "lookup";
private static final String TRANS_STATUS_KEY= "transStatus";
private static final String TRANS_STATUS_REASON_KEY= "transStatusReason";

private String mCavv;
private String mDsTransactionId;
Expand All @@ -38,6 +42,10 @@ public class ThreeDSecureInfo implements Parcelable {
private String mAcsTransactionId;
private String mThreeDSecureServerTransactionId;
private String mParesStatus;
private String mAuthenticationTransactionStatus;
private String mAuthenticationTransactionStatusReason;
private String mLookupTransactionStatus;
private String mLookupTransactionStatusReason;

protected static ThreeDSecureInfo fromJson(JSONObject json) {
if (json == null) {
Expand All @@ -59,6 +67,18 @@ protected static ThreeDSecureInfo fromJson(JSONObject json) {
threeDSecureInfo.mThreeDSecureServerTransactionId = json.optString(THREE_D_SECURE_SERVER_TRANSACTION_ID_KEY);
threeDSecureInfo.mParesStatus = json.optString(PARES_STATUS_KEY);

JSONObject authenticationJson = json.optJSONObject(AUTHENTICATION_KEY);
if (authenticationJson != null) {
threeDSecureInfo.mAuthenticationTransactionStatus = authenticationJson.optString(TRANS_STATUS_KEY);
threeDSecureInfo.mAuthenticationTransactionStatusReason = authenticationJson.optString(TRANS_STATUS_REASON_KEY);
}

JSONObject lookupJson = json.optJSONObject(LOOKUP_KEY);
if (lookupJson != null) {
threeDSecureInfo.mLookupTransactionStatus = lookupJson.optString(TRANS_STATUS_KEY);
threeDSecureInfo.mLookupTransactionStatusReason = lookupJson.optString(TRANS_STATUS_REASON_KEY);
}

return threeDSecureInfo;
}

Expand Down Expand Up @@ -175,6 +195,34 @@ public ThreeDSecureAuthenticationResponse getThreeDSecureAuthenticationResponse(
return mThreeDSecureAuthenticationResponse;
}

/**
* @return On authentication, the transaction status result identifier.
*/
public String getAuthenticationTransactionStatus() {
return mAuthenticationTransactionStatus;
}

/**
* @return On authentication, provides additional information as to why the transaction status has the specific value.
*/
public String getAuthenticationTransactionStatusReason() {
return mAuthenticationTransactionStatusReason;
}

/**
* @return On lookup, the transaction status result identifier.
*/
public String getLookupTransactionStatus() {
return mLookupTransactionStatus;
}

/**
* @return On lookup, provides additional information as to why the transaction status has the specific value.
*/
public String getLookupTransactionStatusReason() {
return mLookupTransactionStatusReason;
}

public ThreeDSecureInfo() {}

@Override
Expand All @@ -194,6 +242,10 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mThreeDSecureVersion);
dest.writeByte(mWasVerified ? (byte) 1 : (byte) 0);
dest.writeString(mXid);
dest.writeString(mAuthenticationTransactionStatus);
dest.writeString(mAuthenticationTransactionStatusReason);
dest.writeString(mLookupTransactionStatus);
dest.writeString(mLookupTransactionStatusReason);
}

private ThreeDSecureInfo(Parcel in) {
Expand All @@ -207,6 +259,10 @@ private ThreeDSecureInfo(Parcel in) {
mThreeDSecureVersion = in.readString();
mWasVerified = in.readByte() != 0;
mXid = in.readString();
mAuthenticationTransactionStatus = in.readString();
mAuthenticationTransactionStatusReason = in.readString();
mLookupTransactionStatus = in.readString();
mLookupTransactionStatusReason = in.readString();
}

public static final Creator<ThreeDSecureInfo> CREATOR = new Creator<ThreeDSecureInfo>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ public void canCreateThreeDSecureInfoFromJson() throws JSONException {
assertEquals("fake-acs-transaction-id", info.getAcsTransactionId());
assertEquals("fake-threedsecure-server-transaction-id", info.getThreeDSecureServerTransactionId());
assertEquals("fake-pares-status", info.getParesStatus());
assertEquals("Y", info.getAuthenticationTransactionStatus());
assertEquals("01", info.getAuthenticationTransactionStatusReason());
assertEquals("N", info.getLookupTransactionStatus());
assertEquals("02", info.getLookupTransactionStatusReason());
}
}
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Braintree Android SDK Release Notes

## 3.5.0
## unreleased

* Add 3DSecure authentication details to card nonce
* Add authentication and lookup transaction status information to ThreeDSecureInfo
* Add ability to customize UI for 3D Secure challenge views
* Fix race condition that caused inconsistent 3DS version flows

## 3.5.0

* Add 3DSecure authentication details to card nonce

## 3.4.2

* Add `acsTransactionId`, `threeDSecureServerTransactionId` and `paresStatus` fields to `ThreeDSecureInfo`
Expand Down

0 comments on commit e89e278

Please sign in to comment.