正在查看: Crafto v9.3.3 应用的 SetupIntent.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 SetupIntent.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.stripe.android.model;
import android.os.Parcel;
import android.os.Parcelable;
import c0.u0;
import com.stripe.android.core.model.StripeModel;
import com.stripe.android.model.StripeIntent;
import com.stripe.android.model.parsers.SetupIntentJsonParser;
import java.util.List;
import java.util.ListIterator;
import java.util.regex.Pattern;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.collections.F;
import kotlin.collections.o;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@Metadata
public final class SetupIntent implements StripeIntent {
private final CancellationReason cancellationReason;
private final String clientSecret;
private final long created;
private final String description;
private final String id;
private final boolean isLiveMode;
private final Error lastSetupError;
private final StripeIntent.NextActionData nextActionData;
private final PaymentMethod paymentMethod;
private final String paymentMethodId;
@NotNull
private final List<String> paymentMethodTypes;
private final StripeIntent.Status status;
@NotNull
private final List<String> unactivatedPaymentMethods;
private final StripeIntent.Usage usage;
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
public static final Parcelable.Creator<SetupIntent> CREATOR = new Creator();
public static final int $stable = 8;
@Metadata
public enum CancellationReason {
Duplicate("duplicate"),
RequestedByCustomer("requested_by_customer"),
Abandoned("abandoned");
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
private final String code;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final CancellationReason fromCode$payments_core_release(String str) {
for (CancellationReason cancellationReason : CancellationReason.values()) {
if (Intrinsics.areEqual(cancellationReason.code, str)) {
return cancellationReason;
}
}
return null;
}
private Companion() {
}
}
CancellationReason(String str) {
this.code = str;
}
}
@Metadata
public static final class ClientSecret {
@NotNull
public static final Companion Companion = new Companion(null);
private static final Pattern PATTERN = Pattern.compile("^seti_[^_]+_secret_[^_]+$");
@NotNull
private final String setupIntentId;
@NotNull
private final String value;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final boolean isMatch(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "value");
return ClientSecret.PATTERN.matcher(str).matches();
}
private Companion() {
}
}
public ClientSecret(@NotNull String str) {
List list;
Intrinsics.checkNotNullParameter(str, "value");
this.value = str;
List e = new Regex("_secret").e(str);
if (!e.isEmpty()) {
ListIterator listIterator = e.listIterator(e.size());
while (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() != 0) {
list = CollectionsKt.W(e, listIterator.nextIndex() + 1);
break;
}
}
}
list = F.a;
Object[] array = list.toArray(new String[0]);
if (array == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
}
this.setupIntentId = ((String[]) array)[0];
if (Companion.isMatch(this.value)) {
return;
}
throw new IllegalArgumentException(("Invalid Setup Intent client secret: " + this.value).toString());
}
public static ClientSecret copy$default(ClientSecret clientSecret, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = clientSecret.value;
}
return clientSecret.copy(str);
}
@NotNull
public final String component1$payments_core_release() {
return this.value;
}
@NotNull
public final ClientSecret copy(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "value");
return new ClientSecret(str);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return (obj instanceof ClientSecret) && Intrinsics.areEqual(this.value, ((ClientSecret) obj).value);
}
@NotNull
public final String getSetupIntentId$payments_core_release() {
return this.setupIntentId;
}
@NotNull
public final String getValue$payments_core_release() {
return this.value;
}
public int hashCode() {
return this.value.hashCode();
}
@NotNull
public String toString() {
return u0.a(new StringBuilder("ClientSecret(value="), this.value, ')');
}
}
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final SetupIntent fromJson(JSONObject jSONObject) {
if (jSONObject != null) {
return new SetupIntentJsonParser().parse(jSONObject);
}
return null;
}
private Companion() {
}
}
@Metadata
public static final class Creator implements Parcelable.Creator<SetupIntent> {
@Override
@NotNull
public final SetupIntent createFromParcel(@NotNull Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new SetupIntent(parcel.readString(), parcel.readInt() == 0 ? null : CancellationReason.valueOf(parcel.readString()), parcel.readLong(), parcel.readString(), parcel.readString(), parcel.readInt() != 0, parcel.readInt() == 0 ? null : PaymentMethod.CREATOR.createFromParcel(parcel), parcel.readString(), parcel.createStringArrayList(), parcel.readInt() == 0 ? null : StripeIntent.Status.valueOf(parcel.readString()), parcel.readInt() == 0 ? null : StripeIntent.Usage.valueOf(parcel.readString()), parcel.readInt() != 0 ? Error.CREATOR.createFromParcel(parcel) : null, parcel.createStringArrayList(), (StripeIntent.NextActionData) parcel.readParcelable(SetupIntent.class.getClassLoader()));
}
@Override
@NotNull
public final SetupIntent[] newArray(int i) {
return new SetupIntent[i];
}
}
@Metadata
public static final class Error implements StripeModel {
@NotNull
public static final String CODE_AUTHENTICATION_ERROR = "setup_intent_authentication_failure";
private final String code;
private final String declineCode;
private final String docUrl;
private final String message;
private final String param;
private final PaymentMethod paymentMethod;
private final Type type;
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
public static final Parcelable.Creator<Error> CREATOR = new Creator();
public static final int $stable = 8;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
@Metadata
public static final class Creator implements Parcelable.Creator<Error> {
@Override
@NotNull
public final Error createFromParcel(@NotNull Parcel parcel) {
Intrinsics.checkNotNullParameter(parcel, "parcel");
return new Error(parcel.readString(), parcel.readString(), parcel.readString(), parcel.readString(), parcel.readString(), parcel.readInt() == 0 ? null : PaymentMethod.CREATOR.createFromParcel(parcel), parcel.readInt() == 0 ? null : Type.valueOf(parcel.readString()));
}
@Override
@NotNull
public final Error[] newArray(int i) {
return new Error[i];
}
}
@Metadata
public enum Type {
ApiConnectionError("api_connection_error"),
ApiError("api_error"),
AuthenticationError("authentication_error"),
CardError("card_error"),
IdempotencyError("idempotency_error"),
InvalidRequestError("invalid_request_error"),
RateLimitError("rate_limit_error");
@NotNull
public static final Companion Companion = new Companion(null);
@NotNull
private final String code;
@Metadata
public static final class Companion {
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Type fromCode$payments_core_release(String str) {
for (Type type : Type.values()) {
if (Intrinsics.areEqual(type.getCode(), str)) {
return type;
}
}
return null;
}
private Companion() {
}
}
Type(String str) {
this.code = str;
}
@NotNull
public final String getCode() {
return this.code;
}
}
public Error(String str, String str2, String str3, String str4, String str5, PaymentMethod paymentMethod, Type type) {
this.code = str;
this.declineCode = str2;
this.docUrl = str3;
this.message = str4;
this.param = str5;
this.paymentMethod = paymentMethod;
this.type = type;
}
public static Error copy$default(Error error, String str, String str2, String str3, String str4, String str5, PaymentMethod paymentMethod, Type type, int i, Object obj) {
if ((i & 1) != 0) {
str = error.code;
}
if ((i & 2) != 0) {
str2 = error.declineCode;
}
String str6 = str2;
if ((i & 4) != 0) {
str3 = error.docUrl;
}
String str7 = str3;
if ((i & 8) != 0) {
str4 = error.message;
}
String str8 = str4;
if ((i & 16) != 0) {
str5 = error.param;
}
String str9 = str5;
if ((i & 32) != 0) {
paymentMethod = error.paymentMethod;
}
PaymentMethod paymentMethod2 = paymentMethod;
if ((i & 64) != 0) {
type = error.type;
}
return error.copy(str, str6, str7, str8, str9, paymentMethod2, type);
}
public final String component1() {
return this.code;
}
public final String component2() {
return this.declineCode;
}
public final String component3() {
return this.docUrl;
}
public final String component4() {
return this.message;
}
public final String component5() {
return this.param;
}
public final PaymentMethod component6() {
return this.paymentMethod;
}
public final Type component7() {
return this.type;
}
@NotNull
public final Error copy(String str, String str2, String str3, String str4, String str5, PaymentMethod paymentMethod, Type type) {
return new Error(str, str2, str3, str4, str5, paymentMethod, type);
}
@Override
public int describeContents() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Error)) {
return false;
}
Error error = (Error) obj;
return Intrinsics.areEqual(this.code, error.code) && Intrinsics.areEqual(this.declineCode, error.declineCode) && Intrinsics.areEqual(this.docUrl, error.docUrl) && Intrinsics.areEqual(this.message, error.message) && Intrinsics.areEqual(this.param, error.param) && Intrinsics.areEqual(this.paymentMethod, error.paymentMethod) && this.type == error.type;
}
public final String getCode() {
return this.code;
}
public final String getDeclineCode() {
return this.declineCode;
}
public final String getDocUrl() {
return this.docUrl;
}
public final String getMessage() {
return this.message;
}
public final String getParam() {
return this.param;
}
public final PaymentMethod getPaymentMethod() {
return this.paymentMethod;
}
public final Type getType() {
return this.type;
}
@Override
public int hashCode() {
String str = this.code;
int hashCode = (str == null ? 0 : str.hashCode()) * 31;
String str2 = this.declineCode;
int hashCode2 = (hashCode + (str2 == null ? 0 : str2.hashCode())) * 31;
String str3 = this.docUrl;
int hashCode3 = (hashCode2 + (str3 == null ? 0 : str3.hashCode())) * 31;
String str4 = this.message;
int hashCode4 = (hashCode3 + (str4 == null ? 0 : str4.hashCode())) * 31;
String str5 = this.param;
int hashCode5 = (hashCode4 + (str5 == null ? 0 : str5.hashCode())) * 31;
PaymentMethod paymentMethod = this.paymentMethod;
int hashCode6 = (hashCode5 + (paymentMethod == null ? 0 : paymentMethod.hashCode())) * 31;
Type type = this.type;
return hashCode6 + (type != null ? type.hashCode() : 0);
}
@NotNull
public String toString() {
return "Error(code=" + this.code + ", declineCode=" + this.declineCode + ", docUrl=" + this.docUrl + ", message=" + this.message + ", param=" + this.param + ", paymentMethod=" + this.paymentMethod + ", type=" + this.type + ')';
}
@Override
public void writeToParcel(@NotNull Parcel parcel, int i) {
Intrinsics.checkNotNullParameter(parcel, "out");
parcel.writeString(this.code);
parcel.writeString(this.declineCode);
parcel.writeString(this.docUrl);
parcel.writeString(this.message);
parcel.writeString(this.param);
PaymentMethod paymentMethod = this.paymentMethod;
if (paymentMethod == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
paymentMethod.writeToParcel(parcel, i);
}
Type type = this.type;
if (type == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
parcel.writeString(type.name());
}
}
}
public SetupIntent(String str, CancellationReason cancellationReason, long j, String str2, String str3, boolean z, PaymentMethod paymentMethod, String str4, @NotNull List<String> list, StripeIntent.Status status, StripeIntent.Usage usage, Error error, @NotNull List<String> list2, StripeIntent.NextActionData nextActionData) {
Intrinsics.checkNotNullParameter(list, "paymentMethodTypes");
Intrinsics.checkNotNullParameter(list2, "unactivatedPaymentMethods");
this.id = str;
this.cancellationReason = cancellationReason;
this.created = j;
this.clientSecret = str2;
this.description = str3;
this.isLiveMode = z;
this.paymentMethod = paymentMethod;
this.paymentMethodId = str4;
this.paymentMethodTypes = list;
this.status = status;
this.usage = usage;
this.lastSetupError = error;
this.unactivatedPaymentMethods = list2;
this.nextActionData = nextActionData;
}
public static final SetupIntent fromJson(JSONObject jSONObject) {
return Companion.fromJson(jSONObject);
}
public final String component1() {
return getId();
}
public final StripeIntent.Status component10() {
return getStatus();
}
public final StripeIntent.Usage component11() {
return this.usage;
}
public final Error component12() {
return this.lastSetupError;
}
@NotNull
public final List<String> component13() {
return getUnactivatedPaymentMethods();
}
public final StripeIntent.NextActionData component14() {
return getNextActionData();
}
public final CancellationReason component2() {
return this.cancellationReason;
}
public final long component3() {
return getCreated();
}
public final String component4() {
return getClientSecret();
}
public final String component5() {
return getDescription();
}
public final boolean component6() {
return isLiveMode();
}
public final PaymentMethod component7() {
return getPaymentMethod();
}
public final String component8() {
return getPaymentMethodId();
}
@NotNull
public final List<String> component9() {
return getPaymentMethodTypes();
}
@NotNull
public final SetupIntent copy(String str, CancellationReason cancellationReason, long j, String str2, String str3, boolean z, PaymentMethod paymentMethod, String str4, @NotNull List<String> list, StripeIntent.Status status, StripeIntent.Usage usage, Error error, @NotNull List<String> list2, StripeIntent.NextActionData nextActionData) {
Intrinsics.checkNotNullParameter(list, "paymentMethodTypes");
Intrinsics.checkNotNullParameter(list2, "unactivatedPaymentMethods");
return new SetupIntent(str, cancellationReason, j, str2, str3, z, paymentMethod, str4, list, status, usage, error, list2, nextActionData);
}
@Override
public int describeContents() {
return 0;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SetupIntent)) {
return false;
}
SetupIntent setupIntent = (SetupIntent) obj;
return Intrinsics.areEqual(getId(), setupIntent.getId()) && this.cancellationReason == setupIntent.cancellationReason && getCreated() == setupIntent.getCreated() && Intrinsics.areEqual(getClientSecret(), setupIntent.getClientSecret()) && Intrinsics.areEqual(getDescription(), setupIntent.getDescription()) && isLiveMode() == setupIntent.isLiveMode() && Intrinsics.areEqual(getPaymentMethod(), setupIntent.getPaymentMethod()) && Intrinsics.areEqual(getPaymentMethodId(), setupIntent.getPaymentMethodId()) && Intrinsics.areEqual(getPaymentMethodTypes(), setupIntent.getPaymentMethodTypes()) && getStatus() == setupIntent.getStatus() && this.usage == setupIntent.usage && Intrinsics.areEqual(this.lastSetupError, setupIntent.lastSetupError) && Intrinsics.areEqual(getUnactivatedPaymentMethods(), setupIntent.getUnactivatedPaymentMethods()) && Intrinsics.areEqual(getNextActionData(), setupIntent.getNextActionData());
}
public final CancellationReason getCancellationReason() {
return this.cancellationReason;
}
@Override
public String getClientSecret() {
return this.clientSecret;
}
@Override
public long getCreated() {
return this.created;
}
@Override
public String getDescription() {
return this.description;
}
@Override
public String getId() {
return this.id;
}
@Override
public String getLastErrorMessage() {
Error error = this.lastSetupError;
if (error != null) {
return error.getMessage();
}
return null;
}
public final Error getLastSetupError() {
return this.lastSetupError;
}
@Override
public StripeIntent.NextActionData getNextActionData() {
return this.nextActionData;
}
@Override
public StripeIntent.NextActionType getNextActionType() {
StripeIntent.NextActionData nextActionData = getNextActionData();
if (nextActionData instanceof StripeIntent.NextActionData.SdkData) {
return StripeIntent.NextActionType.UseStripeSdk;
}
if (nextActionData instanceof StripeIntent.NextActionData.RedirectToUrl) {
return StripeIntent.NextActionType.RedirectToUrl;
}
if (nextActionData instanceof StripeIntent.NextActionData.DisplayOxxoDetails) {
return StripeIntent.NextActionType.DisplayOxxoDetails;
}
if (nextActionData instanceof StripeIntent.NextActionData.VerifyWithMicrodeposits) {
return StripeIntent.NextActionType.VerifyWithMicrodeposits;
}
return null;
}
@Override
public PaymentMethod getPaymentMethod() {
return this.paymentMethod;
}
@Override
public String getPaymentMethodId() {
return this.paymentMethodId;
}
@Override
@NotNull
public List<String> getPaymentMethodTypes() {
return this.paymentMethodTypes;
}
@Override
public StripeIntent.Status getStatus() {
return this.status;
}
@Override
@NotNull
public List<String> getUnactivatedPaymentMethods() {
return this.unactivatedPaymentMethods;
}
public final StripeIntent.Usage getUsage() {
return this.usage;
}
@Override
public int hashCode() {
int hashCode = (getId() == null ? 0 : getId().hashCode()) * 31;
CancellationReason cancellationReason = this.cancellationReason;
int hashCode2 = (hashCode + (cancellationReason == null ? 0 : cancellationReason.hashCode())) * 31;
long created = getCreated();
int hashCode3 = (((((hashCode2 + ((int) (created ^ (created >>> 32)))) * 31) + (getClientSecret() == null ? 0 : getClientSecret().hashCode())) * 31) + (getDescription() == null ? 0 : getDescription().hashCode())) * 31;
boolean isLiveMode = isLiveMode();
int i = isLiveMode;
if (isLiveMode) {
i = 1;
}
int hashCode4 = (((getPaymentMethodTypes().hashCode() + ((((((hashCode3 + i) * 31) + (getPaymentMethod() == null ? 0 : getPaymentMethod().hashCode())) * 31) + (getPaymentMethodId() == null ? 0 : getPaymentMethodId().hashCode())) * 31)) * 31) + (getStatus() == null ? 0 : getStatus().hashCode())) * 31;
StripeIntent.Usage usage = this.usage;
int hashCode5 = (hashCode4 + (usage == null ? 0 : usage.hashCode())) * 31;
Error error = this.lastSetupError;
return ((getUnactivatedPaymentMethods().hashCode() + ((hashCode5 + (error == null ? 0 : error.hashCode())) * 31)) * 31) + (getNextActionData() != null ? getNextActionData().hashCode() : 0);
}
@Override
public boolean isConfirmed() {
StripeIntent.Status[] statusArr = {StripeIntent.Status.Processing, StripeIntent.Status.Succeeded};
Intrinsics.checkNotNullParameter(statusArr, "elements");
return CollectionsKt.A(o.J(statusArr), getStatus());
}
@Override
public boolean isLiveMode() {
return this.isLiveMode;
}
@Override
public boolean requiresAction() {
return getStatus() == StripeIntent.Status.RequiresAction;
}
@Override
public boolean requiresConfirmation() {
return getStatus() == StripeIntent.Status.RequiresConfirmation;
}
@NotNull
public String toString() {
return "SetupIntent(id=" + getId() + ", cancellationReason=" + this.cancellationReason + ", created=" + getCreated() + ", clientSecret=" + getClientSecret() + ", description=" + getDescription() + ", isLiveMode=" + isLiveMode() + ", paymentMethod=" + getPaymentMethod() + ", paymentMethodId=" + getPaymentMethodId() + ", paymentMethodTypes=" + getPaymentMethodTypes() + ", status=" + getStatus() + ", usage=" + this.usage + ", lastSetupError=" + this.lastSetupError + ", unactivatedPaymentMethods=" + getUnactivatedPaymentMethods() + ", nextActionData=" + getNextActionData() + ')';
}
@Override
public void writeToParcel(@NotNull Parcel parcel, int i) {
Intrinsics.checkNotNullParameter(parcel, "out");
parcel.writeString(this.id);
CancellationReason cancellationReason = this.cancellationReason;
if (cancellationReason == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
parcel.writeString(cancellationReason.name());
}
parcel.writeLong(this.created);
parcel.writeString(this.clientSecret);
parcel.writeString(this.description);
parcel.writeInt(this.isLiveMode ? 1 : 0);
PaymentMethod paymentMethod = this.paymentMethod;
if (paymentMethod == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
paymentMethod.writeToParcel(parcel, i);
}
parcel.writeString(this.paymentMethodId);
parcel.writeStringList(this.paymentMethodTypes);
StripeIntent.Status status = this.status;
if (status == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
parcel.writeString(status.name());
}
StripeIntent.Usage usage = this.usage;
if (usage == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
parcel.writeString(usage.name());
}
Error error = this.lastSetupError;
if (error == null) {
parcel.writeInt(0);
} else {
parcel.writeInt(1);
error.writeToParcel(parcel, i);
}
parcel.writeStringList(this.unactivatedPaymentMethods);
parcel.writeParcelable(this.nextActionData, i);
}
public SetupIntent(String str, CancellationReason cancellationReason, long j, String str2, String str3, boolean z, PaymentMethod paymentMethod, String str4, List list, StripeIntent.Status status, StripeIntent.Usage usage, Error error, List list2, StripeIntent.NextActionData nextActionData, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, cancellationReason, j, str2, str3, z, (i & 64) != 0 ? null : paymentMethod, str4, list, status, usage, (i & 2048) != 0 ? null : error, list2, nextActionData);
}
}