diff --git a/admin/config/application.rb b/admin/config/application.rb index 17dfaaf20..93e608c87 100644 --- a/admin/config/application.rb +++ b/admin/config/application.rb @@ -148,10 +148,6 @@ module JamAdmin config.max_track_upload_failures = 10 config.max_track_part_upload_failures = 3 - # Use Private API Keys to communicate with Recurly's API v2. See https://docs.recurly.com/api/basics/authentication to learn more. - config.recurly_private_api_key = '55f2fdfa4d014e64a94eaba1e93f39bb' - # Use Public Keys to identify your site when using Recurly.js. See https://docs.recurly.com/js/#include to learn more. - config.recurly_public_api_key = 'ewr1-HciusxMNfSSjz5WlupGk0C' # these values work out of the box with default settings of an influx install (you do have to add a development database by hand though) config.influxdb_database = "development" diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 0d38beaab..491693c02 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -388,14 +388,38 @@ module JamRuby end def self.subscription_sync + recurly_client = RecurlyClient.new - User - .where('subscription_last_checked_at is NULL OR users.subs < ?', 1.days.ago) - .where("recurly_subscription_id IS NOT NULL OR (subscription_sync_code not in ('trial_ended', 'no_recurly_account', 'admin_control', 'school_license', 'no_subscription_or_expired'))") - .order('subscription_last_checked_at ASC NULLS FIRST') - .each do |user| - recurly_client.sync_subscription(user) + + start = DateTime.now + total = 0 + + loop do + any = false + User + .where('subscription_last_checked_at is NULL OR users.subscription_last_checked_at < ?', 1.days.ago) + .where("recurly_subscription_id IS NOT NULL OR (subscription_sync_code not in ('trial_ended', 'no_recurly_account', 'admin_control', 'school_license', 'no_subscription_or_expired'))") + .order('subscription_last_checked_at ASC NULLS FIRST, recurly_code ASC NULLS LAST') + .limit(1000) + .each do |user| + @@log.info("sync_subscription for user starting #{user.email}") + total = total + 1 + any = true + recurly_client.sync_subscription(user) + end + + # for testing when no results + #any = true + + sleep(20) + + # eat up work to do for up to 30 minutes + break if !any || Time.now - 30.minutes > start end + + msg = "subscription_sync ran for #{(Time.now - start)/60} min time and processed #{total} accounts" + puts(msg) + @@log.info(msg) end def self.first_lesson_instructions diff --git a/ruby/lib/jam_ruby/resque/scheduled/hourly_job.rb b/ruby/lib/jam_ruby/resque/scheduled/hourly_job.rb index d2d64000c..6efbe7d50 100644 --- a/ruby/lib/jam_ruby/resque/scheduled/hourly_job.rb +++ b/ruby/lib/jam_ruby/resque/scheduled/hourly_job.rb @@ -6,14 +6,14 @@ module JamRuby @@log = Logging.logger[HourlyJob] def self.perform - @@log.debug("waking up") + @@log.info("waking up") - LessonBooking.hourly_check - LessonSession.hourly_check - TeacherPayment.hourly_check + #LessonBooking.hourly_check + #LessonSession.hourly_check + #TeacherPayment.hourly_check User.hourly_check - @@log.debug("done") + @@log.info("done") end end end diff --git a/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee index 174540359..5acc500b6 100644 --- a/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee @@ -510,7 +510,21 @@ profileUtils = context.JK.ProfileUtils defaultText: () -> 'Select Country' + openBrowserToPayment: () -> + context.JK.popExternalLink("/client#/account/paymentHistory", true) + paymentMethod: () -> + if context.jamClient.IsNativeClient() + return `
+
+

Updating payment is only supported in a web browser. Please click the button below to open this page in your system web browser.

+

+ UPDATE PAYMENT METHOD +

+
+
+
` + disabled = @state.updating || @reuseStoredCard() submitClassNames = {'button-orange': true, 'purchase-btn': true, disabled: disabled && @state.updating} diff --git a/web/app/assets/javascripts/react-components/CurrentSubscription.js.jsx.coffee b/web/app/assets/javascripts/react-components/CurrentSubscription.js.jsx.coffee index 95b9a4b4e..bcf0459ca 100644 --- a/web/app/assets/javascripts/react-components/CurrentSubscription.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/CurrentSubscription.js.jsx.coffee @@ -52,6 +52,19 @@ AppStore = context.AppStore return @performSubmit() + # user selects button on main page + onUpdatePaymentMethod: () -> + if gon.isNativeClient + context.JK.popExternalLink("/client#/account/paymentHistory", true) + else + window.location.href = "/client#/account/paymentHistory" + + openBrowserToPayment: () -> + if gon.isNativeClient + context.JK.popExternalLink("/client#/account/paymentHistory", true) + else + window.location.href = "/client#/account/paymentHistory" + performSubmit: () -> if !@state.selectedPlan? return @@ -68,10 +81,33 @@ AppStore = context.AppStore text: "Thank you for supporting JamKazam!" }) else - @props.app.layout.notify({ - title: "Payment method still needed", - text: "Please click UPDATE PAYMENT METHOD in the bottom-right of the screen." - }) + if subscription.desired_plan_code + if gon.isNativeClient + html = context._.template($('#template-payment-still-needed-native').html(), {}, { variable: 'data' }) + else + html = context._.template($('#template-payment-still-needed').html(), {}, { variable: 'data' }) + + buttons = [] + buttons.push({name: 'CLOSE', buttonStyle: 'button-grey'}) + buttons.push({ + name: 'UPDATE PAYMENT METHOD', + buttonStyle: 'button-orange', + click: (() => (@openBrowserToPayment())) + }) + context.JK.Banner.show({ + title: "Payment Method Needed", + html: html, + buttons: buttons}) + else + @props.app.layout.notify({ + title: "Subscription updated!", + text: "Thank you for supporting JamKazam!" + }) + + #@props.app.layout.notify({ + # title: "Payment method still needed", + # text: "Please click UPDATE PAYMENT METHOD in the bottom-right of the screen." + #}) @setState({updating: false, selectedPlan: null}) ) .fail((jqXHR) => @@ -175,7 +211,7 @@ AppStore = context.AppStore # free plan situation - not much to go on about explanation = `You are currently on the {desired_plan_name} plan.` if show_payment_info - update_payment_btn = `UPDATE PAYMENT METHOD` + update_payment_btn = `UPDATE PAYMENT METHOD` if has_pending_subscription billingAddendum = null #`

You will be billed next at the {this.getDisplayNameTier(this.props.subscription.subscription.plan.plan_code)} on the next billing cycle.
` else if cancelled_subscription && this.props.subscription.desired_plan_code == null && this.props.subscription.plan_code != null diff --git a/web/app/assets/javascripts/wizard/gear/step_select_gear.js b/web/app/assets/javascripts/wizard/gear/step_select_gear.js index 79ffd0f68..850420718 100644 --- a/web/app/assets/javascripts/wizard/gear/step_select_gear.js +++ b/web/app/assets/javascripts/wizard/gear/step_select_gear.js @@ -1015,7 +1015,7 @@ function prodUserAboutHighLatency($btn, additional) { setTimeout(function() { - $highLatencyNotice = context.JK.prodBubble($btn, 'high-latency-notice', {additional: additional}, {duration: 20000, width:'400px', positions:['top']}); + $highLatencyNotice = context.JK.prodBubble($btn, 'high-latency-notice', {additional: additional, os:operatingSystem}, {duration: 20000, width:'400px', positions:['top']}); }, 300) } diff --git a/web/app/views/clients/_help.html.slim b/web/app/views/clients/_help.html.slim index 0401f84b5..e72bf3acd 100644 --- a/web/app/views/clients/_help.html.slim +++ b/web/app/views/clients/_help.html.slim @@ -27,6 +27,17 @@ script type="text/template" id="template-help-can-move-on" .help-can-move-on | You can move to the next step now. +script type="text/template" id="template-payment-still-needed" + .payment-still-needed + | Thank you for upgrading your plan. For it to take effect, you will need to enter a payment method. + +script type="text/template" id="template-payment-still-needed-native" + .payment-still-needed + | Thank you for upgrading your plan. For it to take effect, you will need to enter a payment method. + br + br + | Your web browser will open if you select UPDATE PAYMENT METHOD. + script type="text/template" id="template-help-tweak-asio-settings" | Click here to try faster ASIO settings. @@ -37,19 +48,24 @@ script type="text/template" id="template-help-high-latency-notice" p | If you are unable to get your audio gear latency below 20 milliseconds, you can click NEXT to proceed through setup with a high-latency audio profile. This will allow you to play with JamTracks and backing tracks, but not play with others.  p - a href="https://jamkazam.desk.com/customer/en/portal/articles/2400685-using-the-setup-wizard-%E2%80%93-step-2-%E2%80%93-select-and-test-audio-gear" rel="external" Click here + a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123617-setup-wizard-windows-step-2-setting-up-your-audio-interface" rel="external" Click here |  for more troubleshooting tips to speed up your audio gear setup. | {% } else if(data.additional == 'macosx-builtin') { %} p.gear-specific-latency-notice Tip: Insert your headphones on a Mac to bring your latency down, and click the RESYNC button to try again. p | If you are unable to get your audio gear latency below 20 milliseconds, you can click NEXT to proceed through setup with a high-latency audio profile. This will allow you to play with JamTracks and backing tracks, but not play with others.  p - a href="https://jamkazam.desk.com/customer/en/portal/articles/2400685-using-the-setup-wizard-%E2%80%93-step-2-%E2%80%93-select-and-test-audio-gear" rel="external" Click here + a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123592-setup-wizard-mac-step-2-setting-up-your-audio-interface" rel="external" Click here |  for more troubleshooting tips to speed up your audio gear setup. + | {% } else if(data.os == 'Win32') { %} + p.general-info + | Your computer and interface are processing audio too slowly to play online in real-time sessions with other musicians over the Internet. You may click NEXT to proceed through setup to play alone in sessions with JamTracks or backing tracks, or if you want to improve your speed score to play online,  + a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123617-setup-wizard-windows-step-2-setting-up-your-audio-interface" rel="external" click here + |  for a troubleshooting article. | {% } else { %} p.general-info | Your computer and interface are processing audio too slowly to play online in real-time sessions with other musicians over the Internet. You may click NEXT to proceed through setup to play alone in sessions with JamTracks or backing tracks, or if you want to improve your speed score to play online,  - a href="https://jamkazam.desk.com/customer/en/portal/articles/2400685-using-the-setup-wizard-%E2%80%93-step-2-%E2%80%93-select-and-test-audio-gear" rel="external" click here + a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123592-setup-wizard-mac-step-2-setting-up-your-audio-interface" rel="external" click here |  for a troubleshooting article. | {% } %}