refinements for payment and ASIO link problem

This commit is contained in:
Seth Call 2020-12-02 09:30:58 -06:00
parent 9a49ab5baa
commit 5b7ba2f99d
7 changed files with 110 additions and 24 deletions

View File

@ -148,10 +148,6 @@ module JamAdmin
config.max_track_upload_failures = 10 config.max_track_upload_failures = 10
config.max_track_part_upload_failures = 3 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) # 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" config.influxdb_database = "development"

View File

@ -388,14 +388,38 @@ module JamRuby
end end
def self.subscription_sync def self.subscription_sync
recurly_client = RecurlyClient.new recurly_client = RecurlyClient.new
User
.where('subscription_last_checked_at is NULL OR users.subs < ?', 1.days.ago) start = DateTime.now
.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'))") total = 0
.order('subscription_last_checked_at ASC NULLS FIRST')
.each do |user| loop do
recurly_client.sync_subscription(user) 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 end
msg = "subscription_sync ran for #{(Time.now - start)/60} min time and processed #{total} accounts"
puts(msg)
@@log.info(msg)
end end
def self.first_lesson_instructions def self.first_lesson_instructions

View File

@ -6,14 +6,14 @@ module JamRuby
@@log = Logging.logger[HourlyJob] @@log = Logging.logger[HourlyJob]
def self.perform def self.perform
@@log.debug("waking up") @@log.info("waking up")
LessonBooking.hourly_check #LessonBooking.hourly_check
LessonSession.hourly_check #LessonSession.hourly_check
TeacherPayment.hourly_check #TeacherPayment.hourly_check
User.hourly_check User.hourly_check
@@log.debug("done") @@log.info("done")
end end
end end
end end

View File

@ -510,7 +510,21 @@ profileUtils = context.JK.ProfileUtils
defaultText: () -> defaultText: () ->
'Select Country' 'Select Country'
openBrowserToPayment: () ->
context.JK.popExternalLink("/client#/account/paymentHistory", true)
paymentMethod: () -> paymentMethod: () ->
if context.jamClient.IsNativeClient()
return `<div>
<div classNames="column column-left">
<p>Updating payment is only supported in a web browser. Please click the button below to open this page in your system web browser.</p>
<p style={{textAlign: "center"}}>
<a className="button-orange" href='#' onClick={this.openBrowserToPayment}>UPDATE PAYMENT METHOD</a>
</p>
</div>
<br className="clearall"/>
</div>`
disabled = @state.updating || @reuseStoredCard() disabled = @state.updating || @reuseStoredCard()
submitClassNames = {'button-orange': true, 'purchase-btn': true, disabled: disabled && @state.updating} submitClassNames = {'button-orange': true, 'purchase-btn': true, disabled: disabled && @state.updating}

View File

@ -52,6 +52,19 @@ AppStore = context.AppStore
return return
@performSubmit() @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: () -> performSubmit: () ->
if !@state.selectedPlan? if !@state.selectedPlan?
return return
@ -68,10 +81,33 @@ AppStore = context.AppStore
text: "Thank you for supporting JamKazam!" text: "Thank you for supporting JamKazam!"
}) })
else else
@props.app.layout.notify({ if subscription.desired_plan_code
title: "Payment method still needed", if gon.isNativeClient
text: "Please click UPDATE PAYMENT METHOD in the bottom-right of the screen." 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}) @setState({updating: false, selectedPlan: null})
) )
.fail((jqXHR) => .fail((jqXHR) =>
@ -175,7 +211,7 @@ AppStore = context.AppStore
# free plan situation - not much to go on about # free plan situation - not much to go on about
explanation = `<span>You are currently on the {desired_plan_name} plan.</span>` explanation = `<span>You are currently on the {desired_plan_name} plan.</span>`
if show_payment_info if show_payment_info
update_payment_btn = `<a className="button-orange update-payment-method" href="/client#/account/paymentHistory">UPDATE PAYMENT METHOD</a>` update_payment_btn = `<a className="button-orange update-payment-method" href="/client#/account/paymentHistory" onClick={this.onUpdatePaymentMethod}>UPDATE PAYMENT METHOD</a>`
if has_pending_subscription if has_pending_subscription
billingAddendum = null #`<span><br/><br/><span>You will be billed next at the <span className="plan-name">{this.getDisplayNameTier(this.props.subscription.subscription.plan.plan_code)}</span> on the next billing cycle.</span></span>` billingAddendum = null #`<span><br/><br/><span>You will be billed next at the <span className="plan-name">{this.getDisplayNameTier(this.props.subscription.subscription.plan.plan_code)}</span> on the next billing cycle.</span></span>`
else if cancelled_subscription && this.props.subscription.desired_plan_code == null && this.props.subscription.plan_code != null else if cancelled_subscription && this.props.subscription.desired_plan_code == null && this.props.subscription.plan_code != null

View File

@ -1015,7 +1015,7 @@
function prodUserAboutHighLatency($btn, additional) { function prodUserAboutHighLatency($btn, additional) {
setTimeout(function() { 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) }, 300)
} }

View File

@ -27,6 +27,17 @@ script type="text/template" id="template-help-can-move-on"
.help-can-move-on .help-can-move-on
| You can move to the next step now. | 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" script type="text/template" id="template-help-tweak-asio-settings"
| Click here to try faster ASIO settings. | Click here to try faster ASIO settings.
@ -37,19 +48,24 @@ script type="text/template" id="template-help-high-latency-notice"
p 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.&nbsp; | 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.&nbsp;
p 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
| &nbsp;for more troubleshooting tips to speed up your audio gear setup. | &nbsp;for more troubleshooting tips to speed up your audio gear setup.
| {% } else if(data.additional == 'macosx-builtin') { %} | {% } 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.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 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.&nbsp; | 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.&nbsp;
p 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
| &nbsp;for more troubleshooting tips to speed up your audio gear setup. | &nbsp;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,&nbsp;
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123617-setup-wizard-windows-step-2-setting-up-your-audio-interface" rel="external" click here
| &nbsp;for a troubleshooting article.
| {% } else { %} | {% } else { %}
p.general-info 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,&nbsp; | 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,&nbsp;
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
| &nbsp;for a troubleshooting article. | &nbsp;for a troubleshooting article.
| {% } %} | {% } %}