Skip to content

Instantly share code, notes, and snippets.

@nikneroz
Last active June 2, 2019 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikneroz/01d92c22ea059783f57e144cd0c27972 to your computer and use it in GitHub Desktop.
Save nikneroz/01d92c22ea059783f57e144cd0c27972 to your computer and use it in GitHub Desktop.
Migration Plan

Auth ~ 1-2 weeks

Estimations

  • Base logic ~ 1 week
  • Controllers/Views/Mailers ~ 1 week

Authentication:

Library

Guardian - Last commit was 10 days ago. Should work.

Why?

It has full list of required hooks including revoke and refresh methods. Also we can build 2 auth systems.

  • Cookie based for Web
  • JWT based for API.

User will store JWT token in Session and/or Cookie. Also I’ve worked with it and I have a tutorial with explanation how to work with it. https://gist.github.com/nikneroz/2363815cf6d66a8d78ed79a4d6a75203

oAuth:

Library

Uberauth - Last commit was 1 year ago. Should work.

Why?

Looks like we don’t have another choice. We’ll try to use it. If it don’t work, we’ll fork and fix it or write logic in app without it.

Support libs

Devise modules integration

  • database_authenticatable - No problem.
  • registerable - No problem.
  • recoverable - No problem.
  • rememberable - No problem. Guardian supports this.
  • trackable - No problem. IP address(last/current), Login timestamps(last/current) and Sign in counter.
  • validatable - No problem. Standard changeset validations.
  • confirmable - No problem.
  • omniauthable - Uberauth + Support libs.
  • masqueradable - Looks like it's simple functionality. We need to add two routes(login_as, logout_as), check if user admin and add one more user resource to server session.

Stripe

Estimations

  • Stripe base logic ~ 3-6 weeks
  • Stripe controllers and views ~ 1-2 weeks

Library

Stripe for Elixir - Current working version 2018-02-28. Under active development. Last commit was yesterday.

Migration

At this moment hireclub_web is using stripe-rails(1.2.0) and stripe_event(1.7.0). Last working stripe version is for 2017 year. So stripity_stripe should cover all required functionality. We just need to implement all actions from app/actions/stripe_action and add webhooks routes.

Business logic

Profile settings:
  Subscription: 
    - subscribe
    - unsubscribe
  Cards:
    - view all cards
    - add card
    - remove card
  Payments:
    - view all payments

Related services

  • app/services/stripe_service.rb

Related models

  • app/models/payment.rb
  • app/models/customer.rb
  • app/models/invoice.rb
  • app/models/referral_reward.rb
  • app/models/appointment.rb
  • app/models/order.rb
  • app/models/payout.rb
  • app/models/card.rb
  • app/models/bank_account.rb
  • app/models/provider.rb
  • app/models/subscription.rb
  • app/models/plan.rb

Current Events

  • customer.subscription.created
  • customer.subscription.deleted
  • customer.subscription.updated
  • charge.succeeded
  • customer.source.created
  • customer.source.updated
  • account.updated
  • account.external_account.created
  • invoice.created
  • invoice.updated
  • invoice.payment_succeeded
  • customer.created
  • customer.updated

Appointments

Estimations

  • Base chat and relations ~ 1-2 weeks
  • Other functionality - ???

Related models

  • appointment.rb
  • appointment_category.rb
  • appointment_log.rb
  • appointment_message.rb
  • appointment_review.rb
  • appointment_type.rb
  • appointment_type_provider.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment