π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Handle legacy Stripe source fallbacks correctly
vishnukvmd9718b3cd23e8
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.goindex bc3294f3ea..ab1fb759be 100644--- a/server/pkg/controller/stripe.go+++ b/server/pkg/controller/stripe.go@@ -743,6 +743,10 @@ func (c *StripeController) CancelSubAndDeleteCustomer(subscription ente.Subscripfunc getSubscriptionPaymentMethodType(stripeSubscription stripe.Subscription) stripe.PaymentMethodType {if stripeSubscription.DefaultPaymentMethod == nil {+ if stripeSubscription.DefaultSource != nil &&+ stripeSubscription.DefaultSource.Type == stripe.PaymentSourceTypeCard {+ return stripe.PaymentMethodTypeCard+ }if stripeSubscription.Customer != nil {if stripeSubscription.Customer.InvoiceSettings != nil &&stripeSubscription.Customer.InvoiceSettings.DefaultPaymentMethod != nil {@@ -753,10 +757,6 @@ func getSubscriptionPaymentMethodType(stripeSubscription stripe.Subscription) streturn stripe.PaymentMethodTypeCard}}- if stripeSubscription.DefaultSource != nil &&- stripeSubscription.DefaultSource.Type == stripe.PaymentSourceTypeCard {- return stripe.PaymentMethodTypeCard- }log.Info("No default payment method found on subscription or customer")return ""}@@ -774,6 +774,10 @@ func getPaymentIntentErrorPaymentMethodType(paymentIntent stripe.PaymentIntent)if paymentIntent.LastPaymentError.PaymentMethod != nil {return paymentIntent.LastPaymentError.PaymentMethod.Type}+ if paymentIntent.LastPaymentError.Source != nil &&+ paymentIntent.LastPaymentError.Source.Type == stripe.PaymentSourceTypeCard {+ return stripe.PaymentMethodTypeCard+ }return paymentIntent.LastPaymentError.PaymentMethodType}