Skip to content

Commit

Permalink
Expose card brand filtering for private beta (#9589)
Browse files Browse the repository at this point in the history
  • Loading branch information
porter-stripe authored Nov 15, 2024
1 parent 06beaa8 commit fbdc465
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
32 changes: 32 additions & 0 deletions paymentsheet/api/paymentsheet.api
Original file line number Diff line number Diff line change
@@ -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 <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/common/model/CommonConfiguration;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$All;
Expand 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 <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$BrandCategory;
Expand All @@ -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 <init> ()V
public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/paymentsheet/PaymentSheet$CardBrandAcceptance$Disallowed;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -1503,15 +1501,13 @@ class PaymentSheet internal constructor(
/**
* Options to block certain card brands on the client
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
sealed class CardBrandAcceptance : Parcelable {

/**
* Card brand categories that can be allowed or disallowed
*/
@Parcelize
@ExperimentalCardBrandFilteringApi
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
enum class BrandCategory : Parcelable {
/**
* Visa branded cards
Expand All @@ -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

/**
Expand All @@ -1551,7 +1545,6 @@ class PaymentSheet internal constructor(
*/
@JvmStatic
@ExperimentalCardBrandFilteringApi
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun allowed(brands: List<BrandCategory>): CardBrandAcceptance =
Allowed(brands)

Expand All @@ -1562,7 +1555,6 @@ class PaymentSheet internal constructor(
*/
@JvmStatic
@ExperimentalCardBrandFilteringApi
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun disallowed(brands: List<BrandCategory>): CardBrandAcceptance =
Disallowed(brands)
}
Expand Down

0 comments on commit fbdc465

Please sign in to comment.