diff --git a/app/controllers/discourse_subscriptions/hooks_controller.rb b/app/controllers/discourse_subscriptions/hooks_controller.rb index 008aefc..720d730 100644 --- a/app/controllers/discourse_subscriptions/hooks_controller.rb +++ b/app/controllers/discourse_subscriptions/hooks_controller.rb @@ -30,6 +30,10 @@ module DiscourseSubscriptions case event[:type] when "checkout.session.completed" checkout_session = event[:data][:object] + + if SiteSetting.discourse_subscriptions_enable_verbose_logging + Rails.logger.info("checkout.session.completed data: #{checkout_session}") + end email = checkout_session[:customer_email] return head 200 if checkout_session[:status] != "complete" @@ -38,6 +42,10 @@ module DiscourseSubscriptions customer_id = checkout_session[:customer] + if SiteSetting.discourse_subscriptions_enable_verbose_logging + Rails.logger.info("Looking up user with email: #{email}") + end + user = ::User.find_by_username_or_email(email) return render_json_error "customer not found" if !user diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 609a1d8..7836632 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -22,6 +22,7 @@ en: discourse_subscriptions_campaign_show_contributors: Show avatars of the most recent purchases of subscription products. discourse_subscriptions_campaign_product: The Stripe product id to send supporters when they click the button on the campaign. If this setting is blank, supporters will be directed to the main products page. discourse_subscriptions_enable_automatic_tax: Enables automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. + discourse_subscriptions_enable_verbose_logging: Enables more verbose logging to aid in debugging. Please do not leave permantly enabled in production. errors: discourse_patrons_amount_must_be_currency: "Currency amounts must be currencies without dollar symbol (eg 1.50)" diff --git a/config/settings.yml b/config/settings.yml index 82c225a..45df0df 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -81,4 +81,6 @@ discourse_subscriptions: default: "" hidden: true discourse_subscriptions_enable_automatic_tax: + default: false + discourse_subscriptions_enable_verbose_logging: default: false \ No newline at end of file