Skip to content

Commit

Permalink
Land 3ds2 2.2 Feature branch (#9639)
Browse files Browse the repository at this point in the history
* Allows for auto-submittal of the challenge if the view is OOB (#9078)

* 3DS2 Req 71 Implementation (#9077)

* Adds challenge no entry value for req 71

* Updates test

* Make "Y" a constant

* 3DS2 2.2 Device Data Requirements (#9298)

* Add device information updates

* Fixing up tests

* Fix test

* Linting

* Update DeviceDataFactoryImpl.kt

* Update 3ds2sdk.api

* 3DS2 Spec Updates (#9387)

* 3DS2 Analytics Delegate (#9430)

* Allows for auto-submittal of the challenge if the view is OOB

* Analytics implementation

* Update 3ds2sdk.api

* Fix issues

* Utilizing service loader

* Move AnalyticsProvider

* Update 3ds2sdk.api

* Adds landscape layout for challenge zone view

* Update LOA

* Update message version in 3ds2 playground

* Add RestrictTo annotations to public APIs

---------

Co-authored-by: Twig <Twigz@users.noreply.github.com>
Co-authored-by: Twig <aharris.1990@gmail.com>
Co-authored-by: reuben-stripe <107846296+reuben-stripe@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 19, 2024
1 parent e7e9685 commit 1b0976d
Show file tree
Hide file tree
Showing 35 changed files with 803 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ class MainActivity : AppCompatActivity() {
acsTransId = ACS_TRANS_ID,
threeDsServerTransId = SERVER_TRANS_ID,
sdkTransId = SDK_TRANS_ID,
messageVersion = "2.1.0"
messageVersion = "2.2.0",
threeDSRequestorAppURL = "threedsrequestorappurl"
)

val labelCustomization = StripeLabelCustomization()
Expand Down Expand Up @@ -471,7 +472,9 @@ class MainActivity : AppCompatActivity() {
acsTransId = acsTransId,
threeDsServerTransId = threeDsServerTransId,
sdkTransId = SDK_TRANS_ID,
messageVersion = "2.1.0"
messageVersion = "2.2.0",
threeDSRequestorAppURL = "threeDSRequestorAppURL"

),
cres,
ChallengeRequestExecutor.Config(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.stripe.android.stripe3ds2playground

import android.util.Log
import com.stripe.android.stripe3ds2.utils.AnalyticsDelegate

internal class SampleAnalyticsImplementation : AnalyticsDelegate {

override fun didReceiveChallengeResponseWithTransactionId(transactionId: String, flow: String) {
Log.d("Playground Analytics", "Did Receive Challenge With Trans ID: $transactionId, $flow")
}

override fun cancelButtonTappedWithTransactionId(transactionId: String) {
Log.d("Playground Analytics", "Cancel Button Tapped With Trans ID: $transactionId")
}

override fun otpSubmitButtonTappedWithTransactionID(transactionId: String) {
Log.d("Playground Analytics", "OTP Submit Tapped With Trans ID: $transactionId")
}

override fun oobContinueButtonTappedWithTransactionID(transactionId: String) {
Log.d("Playground Analytics", "OOB Continue Tapped With Trans ID: $transactionId")
}

override fun oobFlowDidPause(transactionId: String) {
Log.d("Playground Analytics", "OOB Flow Paused: $transactionId")
}

override fun oobFlowDidResume(transactionId: String) {
Log.d("Playground Analytics", "OOB Flow Resumed: $transactionId")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.stripe.android.stripe3ds2playground.SampleAnalyticsImplementation
38 changes: 1 addition & 37 deletions 3ds2sdk/api/3ds2sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public final class com/stripe/android/stripe3ds2/databinding/StripeChallengeZone
public final field czvEntryView Landroid/widget/FrameLayout;
public final field czvHeader Lcom/stripe/android/stripe3ds2/views/ThreeDS2HeaderTextView;
public final field czvInfo Lcom/stripe/android/stripe3ds2/views/ThreeDS2TextView;
public final field czvInfoLabel Lcom/stripe/android/stripe3ds2/views/ThreeDS2TextView;
public final field czvResendButton Lcom/stripe/android/stripe3ds2/views/ThreeDS2Button;
public final field czvSubmitButton Lcom/stripe/android/stripe3ds2/views/ThreeDS2Button;
public final field czvWhitelistNoButton Landroid/widget/RadioButton;
Expand Down Expand Up @@ -146,10 +147,6 @@ public abstract interface class com/stripe/android/stripe3ds2/init/ConfigParamet
public abstract fun removeParam (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
}

public abstract interface class com/stripe/android/stripe3ds2/init/DeviceDataFactory {
public abstract fun create ()Ljava/util/Map;
}

public final class com/stripe/android/stripe3ds2/init/HardwareId$Creator : android/os/Parcelable$Creator {
public fun <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/stripe3ds2/init/HardwareId;
Expand Down Expand Up @@ -1112,39 +1109,6 @@ public abstract interface class com/stripe/android/stripe3ds2/transaction/Transa
public abstract fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class com/stripe/android/stripe3ds2/transactions/ChallengeRequestData : android/os/Parcelable, java/io/Serializable {
public static final field CREATOR Landroid/os/Parcelable$Creator;
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;Ljava/lang/String;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Boolean;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;Ljava/lang/String;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component10 ()Ljava/lang/Boolean;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
public final fun component4 ()Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;
public final fun component5 ()Ljava/lang/String;
public final fun component6 ()Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;
public final fun component7 ()Ljava/lang/String;
public final fun component8 ()Ljava/util/List;
public final fun component9 ()Ljava/lang/Boolean;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;Ljava/lang/String;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData;
public static synthetic fun copy$default (Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;Ljava/lang/String;Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;Ljava/lang/String;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData;
public final fun describeContents ()I
public fun equals (Ljava/lang/Object;)Z
public final fun getAcsTransId ()Ljava/lang/String;
public final fun getCancelReason ()Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;
public final fun getChallengeDataEntry ()Ljava/lang/String;
public final fun getChallengeHtmlDataEntry ()Ljava/lang/String;
public final fun getMessageExtensions ()Ljava/util/List;
public final fun getMessageVersion ()Ljava/lang/String;
public final fun getOobContinue ()Ljava/lang/Boolean;
public final fun getSdkTransId ()Lcom/stripe/android/stripe3ds2/transaction/SdkTransactionId;
public final fun getShouldResendChallenge ()Ljava/lang/Boolean;
public final fun getThreeDsServerTransId ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
public final fun writeToParcel (Landroid/os/Parcel;I)V
}

public final class com/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason : java/lang/Enum {
public static final field Reserved Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;
public static final field TransactionError Lcom/stripe/android/stripe3ds2/transactions/ChallengeRequestData$CancelReason;
Expand Down
2 changes: 1 addition & 1 deletion 3ds2sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs += 'src/main/kotlin'
java.srcDirs += 'src/main/java'
}
Expand Down
109 changes: 109 additions & 0 deletions 3ds2sdk/res/layout-land/stripe_challenge_zone_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:parentTag="LinearLayout">

<com.stripe.android.stripe3ds2.views.ThreeDS2HeaderTextView
android:id="@+id/czv_header"
style="@style/Stripe3DS2HeaderTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
tools:text="Challenge Info Header"
android:accessibilityHeading="true"
tools:ignore="UnusedAttribute" />

<com.stripe.android.stripe3ds2.views.ThreeDS2TextView
android:id="@+id/czv_info"
style="@style/Stripe3DS2TextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
android:drawablePadding="@dimen/stripe_3ds2_challenge_zone_text_indicator_padding"
tools:text="Challenge Info Text" />

<com.stripe.android.stripe3ds2.views.ThreeDS2TextView
android:id="@+id/czv_info_label"
style="@style/Stripe3DS2TextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
android:drawablePadding="@dimen/stripe_3ds2_challenge_zone_text_indicator_padding"
tools:text="Challenge Info Label" />

<FrameLayout
android:id="@+id/czv_entry_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:orientation="horizontal">

<com.stripe.android.stripe3ds2.views.ThreeDS2Button
android:id="@+id/czv_submit_button"
style="@style/Stripe3DS2Button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
android:layout_weight="1"
android:minHeight="48dp"
tools:text="Submit" />

<com.stripe.android.stripe3ds2.views.ThreeDS2Button
android:id="@+id/czv_resend_button"
style="@style/Stripe3DS2TextButton"
android:layout_width="0dp"
android:minHeight="48dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:visibility="gone"
tools:text="Resend Code"
tools:visibility="visible" />
</LinearLayout>

<com.stripe.android.stripe3ds2.views.ThreeDS2TextView
android:id="@+id/czv_whitelisting_label"
style="@style/Stripe3DS2TextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/stripe_3ds2_challenge_zone_select_button_vertical_margin"
android:visibility="gone"
tools:text="Whitelisting Info Text"
tools:visibility="visible" />

<RadioGroup
android:id="@+id/czv_whitelist_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">

<RadioButton
android:id="@+id/czv_whitelist_yes_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stripe_3ds2_challenge_zone_select_button_offset_margin"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_select_button_vertical_margin"
android:paddingStart="@dimen/stripe_3ds2_challenge_zone_select_button_label_padding"
android:paddingEnd="@dimen/stripe_3ds2_challenge_zone_select_button_label_padding"
android:text="@string/stripe_3ds2_czv_whitelist_yes_label" />

<RadioButton
android:id="@+id/czv_whitelist_no_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stripe_3ds2_challenge_zone_select_button_offset_margin"
android:paddingStart="@dimen/stripe_3ds2_challenge_zone_select_button_label_padding"
android:paddingEnd="@dimen/stripe_3ds2_challenge_zone_select_button_label_padding"
android:text="@string/stripe_3ds2_czv_whitelist_no_label" />
</RadioGroup>
</merge>
9 changes: 9 additions & 0 deletions 3ds2sdk/res/layout/stripe_challenge_zone_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
android:drawablePadding="@dimen/stripe_3ds2_challenge_zone_text_indicator_padding"
tools:text="Challenge Info Text" />

<com.stripe.android.stripe3ds2.views.ThreeDS2TextView
android:id="@+id/czv_info_label"
style="@style/Stripe3DS2TextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/stripe_3ds2_challenge_zone_vertical_padding"
android:drawablePadding="@dimen/stripe_3ds2_challenge_zone_text_indicator_padding"
tools:text="Challenge Info Label" />

<FrameLayout
android:id="@+id/czv_entry_view"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.stripe.android.stripe3ds2.init

import androidx.annotation.RestrictTo
import com.stripe.android.stripe3ds2.transaction.SdkTransactionId

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun interface DeviceDataFactory {
fun create(): Map<String, Any?>
suspend fun create(sdkReferenceNumber: String, sdkTransactionId: SdkTransactionId): Map<String, Any?>
}
Loading

0 comments on commit 1b0976d

Please sign in to comment.