π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simplify how last payment method is fetched
vishnukvmdd003542e42f0
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.goindex 67f02456c2..fd43403264 100644--- a/server/pkg/controller/stripe.go+++ b/server/pkg/controller/stripe.go@@ -423,21 +423,15 @@ func (c *StripeController) handleInvoicePaid(event stripe.Event, country ente.Stfunc (c *StripeController) handlePaymentIntentFailed(event stripe.Event, country ente.StripeAccountCountry) (ente.StripeEventLog, error) {var paymentIntent stripe.PaymentIntentjson.Unmarshal(event.Data.Raw, &paymentIntent)- client := c.StripeClients[country]- params := stripe.PaymentIntentParams{}- params.AddExpand("payment_method")- fullPaymentIntent, err := client.PaymentIntents.Get(paymentIntent.ID, ¶ms)- if err != nil {- return ente.StripeEventLog{}, stacktrace.Propagate(err, "")- }-- isSEPA := fullPaymentIntent.PaymentMethod.Type == stripe.PaymentMethodTypeSepaDebit+ isSEPA := paymentIntent.LastPaymentError.PaymentMethod.Type == stripe.PaymentMethodTypeSepaDebitif !isSEPA {// Ignore events for other payment methods, since they will be handled// synchronously+ log.Info("Ignoring payment intent failed event for non-SEPA payment method")return ente.StripeEventLog{}, nil}+ client := c.StripeClients[country]invoiceID := paymentIntent.Invoice.IDinvoice, err := client.Invoices.Get(invoiceID, nil)if err != nil {@@ -577,7 +571,6 @@ func (c *StripeController) UpdateSubscription(stripeID string, userID int64) (en}}return ente.SubscriptionUpdateResponse{Status: "success"}, nil-}func (c *StripeController) UpdateSubscriptionCancellationStatus(userID int64, status bool) (ente.Subscription, error) {