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: [ diff --git a/app/workers/payment_schedule_item_worker.rb b/app/workers/payment_schedule_item_worker.rb index 3f27d0c53..56348aa6b 100644 --- a/app/workers/payment_schedule_item_worker.rb +++ b/app/workers/payment_schedule_item_worker.rb @@ -49,5 +49,7 @@ class PaymentScheduleItemWorker attached_object: psi psi.update_attributes(state: 'pending') end + rescue StandardError + psi.update_attributes(state: 'error') end end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 3ee7ffa7a..5741e847f 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -73,8 +73,8 @@ Rails.application.configure do # config.serve_static_assets = true config.action_mailer.default_url_options = { - host: ->(*) { Setting.get('base_url_host') }, - protocol: ->(*) { Setting.get('base_url_protocol') } + host: Rails.application.secrets.default_host, + protocol: Rails.application.secrets.default_protocol } # config.action_mailer.perform_deliveries = true # config.action_mailer.raise_delivery_errors = false