From fbdc465605fbaf0c57ef4be357aa7cb2260b4aca Mon Sep 17 00:00:00 2001 From: Nick Porter <88012362+porter-stripe@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:57:12 -0700 Subject: [PATCH] Expose card brand filtering for private beta (#9589) --- paymentsheet/api/paymentsheet.api | 32 +++++++++++++++++++ .../ExperimentalCardBrandFilteringApi.kt | 3 -- .../android/customersheet/CustomerSheet.kt | 2 -- .../android/paymentsheet/PaymentSheet.kt | 8 ----- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/paymentsheet/api/paymentsheet.api b/paymentsheet/api/paymentsheet.api index e41f359ed6f..20f579024e9 100644 --- a/paymentsheet/api/paymentsheet.api +++ b/paymentsheet/api/paymentsheet.api @@ -1,6 +1,9 @@ public abstract interface annotation class com/stripe/android/ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi : java/lang/annotation/Annotation { } +public abstract interface annotation class com/stripe/android/ExperimentalCardBrandFilteringApi : java/lang/annotation/Annotation { +} + public final class com/stripe/android/common/model/CommonConfiguration$Creator : android/os/Parcelable$Creator { public fun ()V public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/common/model/CommonConfiguration; @@ -125,6 +128,7 @@ public final class com/stripe/android/customersheet/CustomerSheet$Configuration$ public final fun appearance (Lcom/stripe/android/paymentsheet/PaymentSheet$Appearance;)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; public final fun billingDetailsCollectionConfiguration (Lcom/stripe/android/paymentsheet/PaymentSheet$BillingDetailsCollectionConfiguration;)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; public final fun build ()Lcom/stripe/android/customersheet/CustomerSheet$Configuration; + public final fun cardBrandAcceptance (Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance;)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; public final fun defaultBillingDetails (Lcom/stripe/android/paymentsheet/PaymentSheet$BillingDetails;)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; public final fun googlePayEnabled (Z)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; public final fun headerTextForSelectionScreen (Ljava/lang/String;)Lcom/stripe/android/customersheet/CustomerSheet$Configuration$Builder; @@ -742,6 +746,14 @@ public final class com/stripe/android/paymentsheet/PaymentSheet$Builder { public final fun externalPaymentMethodConfirmHandler (Lcom/stripe/android/paymentsheet/ExternalPaymentMethodConfirmHandler;)Lcom/stripe/android/paymentsheet/PaymentSheet$Builder; } +public abstract class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance : android/os/Parcelable { + public static final field $stable I + public static final field Companion Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$Companion; + public static final fun all ()Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; + public static final fun allowed (Ljava/util/List;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; + public static final fun disallowed (Ljava/util/List;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; +} + public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$All$Creator : android/os/Parcelable$Creator { public fun ()V public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$All; @@ -758,6 +770,19 @@ public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAccepta public synthetic fun newArray (I)[Ljava/lang/Object; } +public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory : java/lang/Enum, android/os/Parcelable { + public static final field Amex Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public static final field CREATOR Landroid/os/Parcelable$Creator; + public static final field Discover Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public static final field Mastercard Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public static final field Visa Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public final fun describeContents ()I + public static fun getEntries ()Lkotlin/enums/EnumEntries; + public static fun valueOf (Ljava/lang/String;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public static fun values ()[Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; + public final fun writeToParcel (Landroid/os/Parcel;I)V +} + public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory$Creator : android/os/Parcelable$Creator { public fun ()V public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory; @@ -766,6 +791,12 @@ public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAccepta public synthetic fun newArray (I)[Ljava/lang/Object; } +public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$Companion { + public final fun all ()Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; + public final fun allowed (Ljava/util/List;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; + public final fun disallowed (Ljava/util/List;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance; +} + public final class com/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$Disallowed$Creator : android/os/Parcelable$Creator { public fun ()V public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$Disallowed; @@ -884,6 +915,7 @@ public final class com/stripe/android/paymentsheet/PaymentSheet$Configuration$Bu public final fun appearance (Lcom/stripe/android/paymentsheet/PaymentSheet$Appearance;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; public final fun billingDetailsCollectionConfiguration (Lcom/stripe/android/paymentsheet/PaymentSheet$BillingDetailsCollectionConfiguration;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; public final fun build ()Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration; + public final fun cardBrandAcceptance (Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; public final fun customer (Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; public final fun defaultBillingDetails (Lcom/stripe/android/paymentsheet/PaymentSheet$BillingDetails;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; public final fun externalPaymentMethods (Ljava/util/List;)Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration$Builder; diff --git a/paymentsheet/src/main/java/com/stripe/android/ExperimentalCardBrandFilteringApi.kt b/paymentsheet/src/main/java/com/stripe/android/ExperimentalCardBrandFilteringApi.kt index d7a1fb63125..6edba64be2a 100644 --- a/paymentsheet/src/main/java/com/stripe/android/ExperimentalCardBrandFilteringApi.kt +++ b/paymentsheet/src/main/java/com/stripe/android/ExperimentalCardBrandFilteringApi.kt @@ -1,11 +1,8 @@ package com.stripe.android -import androidx.annotation.RestrictTo - @RequiresOptIn( level = RequiresOptIn.Level.ERROR, message = "This API is under construction. It can be changed or removed at any time (use at your own risk)" ) @Retention(AnnotationRetention.BINARY) -@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) annotation class ExperimentalCardBrandFilteringApi diff --git a/paymentsheet/src/main/java/com/stripe/android/customersheet/CustomerSheet.kt b/paymentsheet/src/main/java/com/stripe/android/customersheet/CustomerSheet.kt index e70b5a858d6..51b2ef064c8 100644 --- a/paymentsheet/src/main/java/com/stripe/android/customersheet/CustomerSheet.kt +++ b/paymentsheet/src/main/java/com/stripe/android/customersheet/CustomerSheet.kt @@ -4,7 +4,6 @@ import android.app.Application import android.os.Parcelable import androidx.activity.ComponentActivity import androidx.activity.result.ActivityResultRegistryOwner -import androidx.annotation.RestrictTo import androidx.core.app.ActivityOptionsCompat import androidx.fragment.app.Fragment import androidx.lifecycle.DefaultLifecycleObserver @@ -323,7 +322,6 @@ class CustomerSheet internal constructor( * **Note**: Card brand filtering is not currently supported in Link. */ @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun cardBrandAcceptance( cardBrandAcceptance: CardBrandAcceptance ) = apply { diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheet.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheet.kt index aa779e166d3..c6059bf0f9a 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheet.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/PaymentSheet.kt @@ -6,7 +6,6 @@ import android.os.Parcelable import androidx.activity.ComponentActivity import androidx.annotation.ColorInt import androidx.annotation.FontRes -import androidx.annotation.RestrictTo import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb @@ -824,7 +823,6 @@ class PaymentSheet internal constructor( * **Note**: Card brand filtering is not currently supported in Link. */ @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun cardBrandAcceptance( cardBrandAcceptance: CardBrandAcceptance ) = apply { @@ -1503,7 +1501,6 @@ class PaymentSheet internal constructor( /** * Options to block certain card brands on the client */ - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) sealed class CardBrandAcceptance : Parcelable { /** @@ -1511,7 +1508,6 @@ class PaymentSheet internal constructor( */ @Parcelize @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) enum class BrandCategory : Parcelable { /** * Visa branded cards @@ -1535,14 +1531,12 @@ class PaymentSheet internal constructor( Discover } - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) companion object { /** * Accept all card brands supported by Stripe */ @JvmStatic @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun all(): CardBrandAcceptance = All /** @@ -1551,7 +1545,6 @@ class PaymentSheet internal constructor( */ @JvmStatic @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun allowed(brands: List): CardBrandAcceptance = Allowed(brands) @@ -1562,7 +1555,6 @@ class PaymentSheet internal constructor( */ @JvmStatic @ExperimentalCardBrandFilteringApi - @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun disallowed(brands: List): CardBrandAcceptance = Disallowed(brands) }