From 305e46201120c80853f3eeb5dcfbf21f88d5ddda Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 22 Feb 2021 11:28:52 +0100 Subject: [PATCH] on stripe subscription renew: cancel subscription after the last deadline --- app/services/stripe_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/stripe_service.rb b/app/services/stripe_service.rb index ad2a1cf3e..fdf10443d 100644 --- a/app/services/stripe_service.rb +++ b/app/services/stripe_service.rb @@ -33,7 +33,7 @@ class StripeService stp_subscription = Stripe::Subscription.create({ customer: payment_schedule.invoicing_profile.user.stp_customer_id, - cancel_at: subscription.expiration_date.to_i, + cancel_at: (payment_schedule.ordered_items.last.due_date + 3.day).to_i, add_invoice_items: items, coupon: payment_schedule.coupon&.code, items: [