kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash when outcomeReason is null.
rodzic
43f4bc5abe
commit
f9c0156757
|
@ -301,6 +301,8 @@ public class SubscriptionReceiptRequestResponseJob extends BaseJob {
|
||||||
SignalStore.donationsValues().setUnexpectedSubscriptionCancelationTimestamp(timestamp);
|
SignalStore.donationsValues().setUnexpectedSubscriptionCancelationTimestamp(timestamp);
|
||||||
MultiDeviceSubscriptionSyncRequestJob.enqueue();
|
MultiDeviceSubscriptionSyncRequestJob.enqueue();
|
||||||
} else if (chargeFailure != null) {
|
} else if (chargeFailure != null) {
|
||||||
|
Log.d(TAG, "Charge failure detected: " + chargeFailure, true);
|
||||||
|
|
||||||
StripeDeclineCode declineCode = StripeDeclineCode.Companion.getFromCode(chargeFailure.getOutcomeNetworkReason());
|
StripeDeclineCode declineCode = StripeDeclineCode.Companion.getFromCode(chargeFailure.getOutcomeNetworkReason());
|
||||||
DonationError.PaymentSetupError paymentSetupError;
|
DonationError.PaymentSetupError paymentSetupError;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,11 @@ sealed class StripeDeclineCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getFromCode(code: String): StripeDeclineCode {
|
fun getFromCode(code: String?): StripeDeclineCode {
|
||||||
|
if (code == null) {
|
||||||
|
return Unknown("null")
|
||||||
|
}
|
||||||
|
|
||||||
val typedCode: Code? = Code.values().firstOrNull { it.code == code }
|
val typedCode: Code? = Code.values().firstOrNull { it.code == code }
|
||||||
return typedCode?.let { Known(typedCode) } ?: Unknown(code)
|
return typedCode?.let { Known(typedCode) } ?: Unknown(code)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public final class ActiveSubscription {
|
public final class ActiveSubscription {
|
||||||
|
|
||||||
public static final ActiveSubscription EMPTY = new ActiveSubscription(null, null);
|
public static final ActiveSubscription EMPTY = new ActiveSubscription(null, null);
|
||||||
|
@ -270,7 +272,7 @@ public final class ActiveSubscription {
|
||||||
* <p>
|
* <p>
|
||||||
* See: <a href="https://stripe.com/docs/api/charges/object#charge_object-outcome-reason">https://stripe.com/docs/api/charges/object#charge_object-outcome-reason</a>
|
* See: <a href="https://stripe.com/docs/api/charges/object#charge_object-outcome-reason">https://stripe.com/docs/api/charges/object#charge_object-outcome-reason</a>
|
||||||
*/
|
*/
|
||||||
public String getOutcomeNetworkReason() {
|
public @Nullable String getOutcomeNetworkReason() {
|
||||||
return outcomeNetworkReason;
|
return outcomeNetworkReason;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,5 +284,14 @@ public final class ActiveSubscription {
|
||||||
public String getOutcomeType() {
|
public String getOutcomeType() {
|
||||||
return outcomeType;
|
return outcomeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
return "ChargeFailure{" +
|
||||||
|
"code='" + code + '\'' +
|
||||||
|
", outcomeNetworkStatus='" + outcomeNetworkStatus + '\'' +
|
||||||
|
", outcomeNetworkReason='" + outcomeNetworkReason + '\'' +
|
||||||
|
", outcomeType='" + outcomeType + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue