Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose card brand filtering for private beta #9589

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -726,6 +730,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 @@ -742,6 +754,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 @@ -750,6 +775,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 @@ -868,6 +899,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 @@ -820,7 +819,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 @@ -1499,15 +1497,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 @@ -1531,14 +1527,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 @@ -1547,7 +1541,6 @@ class PaymentSheet internal constructor(
*/
@JvmStatic
@ExperimentalCardBrandFilteringApi
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun allowed(brands: List<BrandCategory>): CardBrandAcceptance =
Allowed(brands)

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