Skip to content

Conversation

@drusepth
Copy link
Member

Work in progress, not ready to merge and needs tested

@@ -0,0 +1,145 @@
class SubscriptionService < Service
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Controllers to Services! Love it!


def self.transition_plan user:, old_plan:, new_plan:, stripe_object: nil
# Fetch the user's current Stripe information
stripe_object ||= SubscriptionService.stripe_customer_object_for(current_user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance this could still return nil?

)

report_subscription_change_to_slack current_user, old_billing_plan, new_billing_plan
SubscriptionService.report_subscription_change_to_slack current_user, old_billing_plan, new_billing_plan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo didn't realize this was a thing!

add_referral_benefits_to(
referree: user
referrer: user.referrer || user # if a user wasn't referred by anyone, we treat them as referring themselves <3
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected token tRPAREN

add_first_time_premium_benefits_to(user)
add_referral_benefits_to(
referree: user
referrer: user.referrer || user # if a user wasn't referred by anyone, we treat them as referring themselves <3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected token tIDENTIFIER

SubscriptionService.add_referral_benefits_to(
referree: current_user
referrer: current_user.referrer || current_user
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected token tRPAREN

SubscriptionService.add_first_time_premium_benefits_to(current_user)
SubscriptionService.add_referral_benefits_to(
referree: current_user
referrer: current_user.referrer || current_user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected token tIDENTIFIER

success = SubscriptionService.transition_plan(
user: current_user,
old_plan: BillingPlan.find(current_user.selected_billing_plan_id)
new_plan: BillingPlan.find(new_plan_id),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unexpected token tIDENTIFIER
unexpected token tCOMMA

@drusepth
Copy link
Member Author

drusepth commented Mar 3, 2018

Replaced by #263

@drusepth drusepth closed this Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants