1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

add operator_id to invoices

This commit is contained in:
Sylvain 2019-03-18 11:11:09 +01:00
parent b439c643cb
commit c356f35f29
12 changed files with 135 additions and 123 deletions

View File

@ -26,7 +26,7 @@ class API::ReservationsController < API::ApiController
user_id = current_user.admin? ? reservation_params[:user_id] : current_user.id
@reservation = Reservation.new(reservation_params)
is_reserve = Reservations::Reserve.new(user_id)
is_reserve = Reservations::Reserve.new(user_id, current_user.id)
.pay_and_save(@reservation, method, coupon_params[:coupon_code])
if is_reserve

View File

@ -19,7 +19,7 @@ class API::SubscriptionsController < API::ApiController
user_id = current_user.admin? ? subscription_params[:user_id] : current_user.id
@subscription = Subscription.new(subscription_params)
is_subscribe = Subscriptions::Subscribe.new(user_id)
is_subscribe = Subscriptions::Subscribe.new(user_id, current_user.id)
.pay_and_save(@subscription, method, coupon_params[:coupon_code], true)
if is_subscribe
@ -35,7 +35,7 @@ class API::SubscriptionsController < API::ApiController
free_days = params[:subscription][:free] || false
res = Subscriptions::Subscribe.new(@subscription.user_id)
res = Subscriptions::Subscribe.new(@subscription.user_id, current_user.id)
.extend_subscription(@subscription, subscription_update_params[:expired_at], free_days)
if res.is_a?(Subscription)
@subscription = res

View File

@ -17,6 +17,7 @@ class Invoice < ActiveRecord::Base
belongs_to :coupon
has_one :avoir, class_name: 'Invoice', foreign_key: :invoice_id, dependent: :destroy
belongs_to :operator, foreign_key: :operator_id, class_name: 'User'
before_create :add_environment
after_create :update_reference, :chain_record
@ -229,7 +230,7 @@ class Invoice < ActiveRecord::Base
invoice_items.map(&:check_footprint).all? && footprint == compute_footprint
end
private
# private
def generate_and_send_invoice
unless Rails.env.test?

View File

@ -20,7 +20,7 @@ class InvoiceItem < ActiveRecord::Base
footprint == compute_footprint
end
private
# private
def compute_footprint
max_date = created_at || Time.current

View File

@ -224,10 +224,10 @@ class Reservation < ActiveRecord::Base
invoice_items
end
def save_with_payment(coupon_code = nil)
def save_with_payment(operator_id, coupon_code = nil)
begin
clean_pending_strip_invoice_items
build_invoice(user: user)
build_invoice(user: user, operator_id: operator_id)
invoice_items = generate_invoice_items(false, coupon_code)
rescue StandardError => e
logger.error e
@ -242,7 +242,7 @@ class Reservation < ActiveRecord::Base
if plan_id
self.subscription = Subscription.find_or_initialize_by(user_id: user.id)
subscription.attributes = { plan_id: plan_id, user_id: user.id, card_token: card_token, expiration_date: nil }
if subscription.save_with_payment(false)
if subscription.save_with_payment(operator_id, false)
self.stp_invoice_id = invoice_items.first.refresh.invoice
invoice.stp_invoice_id = invoice_items.first.refresh.invoice
invoice.invoice_items.push InvoiceItem.new(
@ -368,8 +368,8 @@ class Reservation < ActiveRecord::Base
pending_invoice_items.each(&:delete)
end
def save_with_local_payment(coupon_code = nil)
build_invoice(user: user)
def save_with_local_payment(operator_id, coupon_code = nil)
build_invoice(user: user, operator_id: operator_id)
generate_invoice_items(true, coupon_code)
return false unless valid?
@ -377,7 +377,7 @@ class Reservation < ActiveRecord::Base
if plan_id
self.subscription = Subscription.find_or_initialize_by(user_id: user.id)
subscription.attributes = { plan_id: plan_id, user_id: user.id, expiration_date: nil }
if subscription.save_with_local_payment(false)
if subscription.save_with_local_payment(operator_id, false)
invoice.invoice_items.push InvoiceItem.new(
amount: subscription.plan.amount,
description: subscription.plan.name,

View File

@ -20,7 +20,7 @@ class Subscription < ActiveRecord::Base
# Stripe subscription payment
# @params [invoice] if true then subscription pay itself, dont pay with reservation
# if false then subscription pay with reservation
def save_with_payment(invoice = true, coupon_code = nil)
def save_with_payment(operator_id, invoice = true, coupon_code = nil)
return unless valid?
begin
@ -75,7 +75,7 @@ class Subscription < ActiveRecord::Base
# generate invoice
stp_invoice = Stripe::Invoice.all(customer: user.stp_customer_id, limit: 1).data.first
if invoice
db_invoice = generate_invoice(stp_invoice.id, coupon_code)
db_invoice = generate_invoice(operator_id, stp_invoice.id, coupon_code)
# debit wallet
wallet_transaction = debit_user_wallet
if wallet_transaction
@ -129,7 +129,7 @@ class Subscription < ActiveRecord::Base
# @params [invoice] if true then only the subscription is payed, without reservation
# if false then the subscription is payed with reservation
def save_with_local_payment(invoice = true, coupon_code = nil)
def save_with_local_payment(operator_id, invoice = true, coupon_code = nil)
return false unless valid?
set_expiration_date
@ -142,7 +142,7 @@ class Subscription < ActiveRecord::Base
# debit wallet
wallet_transaction = debit_user_wallet
invoc = generate_invoice(nil, coupon_code)
invoc = generate_invoice(operator_id, nil, coupon_code)
if wallet_transaction
invoc.wallet_amount = @wallet_amount_debit
invoc.wallet_transaction_id = wallet_transaction.id
@ -152,7 +152,7 @@ class Subscription < ActiveRecord::Base
true
end
def generate_invoice(stp_invoice_id = nil, coupon_code = nil)
def generate_invoice(operator_id, stp_invoice_id = nil, coupon_code = nil)
coupon_id = nil
total = plan.amount
@ -165,13 +165,13 @@ class Subscription < ActiveRecord::Base
end
end
invoice = Invoice.new(invoiced_id: id, invoiced_type: 'Subscription', user: user, total: total, stp_invoice_id: stp_invoice_id, coupon_id: coupon_id)
invoice = Invoice.new(invoiced_id: id, invoiced_type: 'Subscription', user: user, total: total, stp_invoice_id: stp_invoice_id, coupon_id: coupon_id, operator_id: operator_id)
invoice.invoice_items.push InvoiceItem.new(amount: plan.amount, stp_invoice_item_id: stp_subscription_id, description: plan.name, subscription_id: self.id)
invoice
end
def generate_and_save_invoice(stp_invoice_id = nil)
generate_invoice(stp_invoice_id).save
def generate_and_save_invoice(operator_id, stp_invoice_id = nil)
generate_invoice(operator_id, stp_invoice_id).save
end
def cancel

View File

@ -44,6 +44,7 @@ class User < ActiveRecord::Base
has_many :machine_credits, through: :users_credits, source: :machine_credit
has_many :invoices, dependent: :destroy
has_many :operated_invoices, foreign_key: :operator_id, class_name: 'Invoice', dependent: :nullify
has_many :user_tags, dependent: :destroy
has_many :tags, through: :user_tags
@ -124,10 +125,10 @@ class User < ActiveRecord::Base
my_projects.to_a.concat projects
end
def generate_subscription_invoice
def generate_subscription_invoice(operator_id)
return unless subscription
subscription.generate_and_save_invoice
subscription.generate_and_save_invoice(operator_id)
end
def stripe_customer

View File

@ -31,7 +31,7 @@ class Members::MembersService
@member.generate_auth_migration_token if current_user.admin? && AuthProvider.active.providable_type != DatabaseProvider.name
if @member.save
@member.generate_subscription_invoice
@member.generate_subscription_invoice(current_user.id)
@member.send_confirmation_instructions
UsersMailer.delay.notify_user_account_created(@member, @member.password)
true

View File

@ -1,18 +1,19 @@
module Reservations
class Reserve
attr_accessor :user_id
attr_accessor :user_id, :operator_id
def initialize(user_id)
def initialize(user_id, operator_id)
@user_id = user_id
@operator_id = operator_id
end
def pay_and_save(reservation, payment_method, coupon)
reservation.user_id = user_id
if payment_method == :local
reservation.save_with_local_payment(coupon)
reservation.save_with_local_payment(operator_id, coupon)
elsif payment_method == :stripe
reservation.save_with_payment(coupon)
reservation.save_with_payment(operator_id, coupon)
end
end
end
end
end

View File

@ -1,17 +1,18 @@
module Subscriptions
class Subscribe
attr_accessor :user_id
attr_accessor :user_id, :operator_id
def initialize(user_id)
def initialize(user_id, operator_id)
@user_id = user_id
@operator_id = operator_id
end
def pay_and_save(subscription, payment_method, coupon, invoice)
subscription.user_id = user_id
if payment_method == :local
subscription.save_with_local_payment(invoice, coupon)
subscription.save_with_local_payment(operator_id, invoice, coupon)
elsif payment_method == :stripe
subscription.save_with_payment(invoice, coupon)
subscription.save_with_payment(operator_id, invoice, coupon)
end
end
@ -24,7 +25,7 @@ module Subscriptions
expiration_date: new_expiration_date
)
if new_sub.save
new_sub.user.generate_subscription_invoice
new_sub.user.generate_subscription_invoice(operator_id)
return new_sub
end
false

View File

@ -0,0 +1,6 @@
class AddOperatorToInvoice < ActiveRecord::Migration
def change
add_column :invoices, :operator_id, :integer
add_foreign_key :invoices, :users, column: :operator_id, primary_key: :id
end
end

View File

@ -11,12 +11,12 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190227143153) do
ActiveRecord::Schema.define(version: 20190314095931) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "pg_trgm"
enable_extension "unaccent"
enable_extension "pg_trgm"
create_table "abuses", force: :cascade do |t|
t.integer "signaled_id"
@ -44,14 +44,14 @@ ActiveRecord::Schema.define(version: 20190227143153) do
end
create_table "addresses", force: :cascade do |t|
t.string "address", limit: 255
t.string "street_number", limit: 255
t.string "route", limit: 255
t.string "locality", limit: 255
t.string "country", limit: 255
t.string "postal_code", limit: 255
t.string "address"
t.string "street_number"
t.string "route"
t.string "locality"
t.string "country"
t.string "postal_code"
t.integer "placeable_id"
t.string "placeable_type", limit: 255
t.string "placeable_type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -67,9 +67,9 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "assets", force: :cascade do |t|
t.integer "viewable_id"
t.string "viewable_type", limit: 255
t.string "attachment", limit: 255
t.string "type", limit: 255
t.string "viewable_type"
t.string "attachment"
t.string "type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -86,12 +86,12 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "availabilities", force: :cascade do |t|
t.datetime "start_at"
t.datetime "end_at"
t.string "available_type", limit: 255
t.string "available_type"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.boolean "destroying", default: false
t.boolean "lock", default: false
t.boolean "destroying", default: false
t.boolean "lock", default: false
end
create_table "availability_tags", force: :cascade do |t|
@ -105,7 +105,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
create_table "categories", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
create_table "components", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
end
create_table "coupons", force: :cascade do |t|
@ -132,7 +132,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "credits", force: :cascade do |t|
t.integer "creditable_id"
t.string "creditable_type", limit: 255
t.string "creditable_type"
t.integer "plan_id"
t.integer "hours"
t.datetime "created_at"
@ -173,7 +173,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
create_table "events", force: :cascade do |t|
t.string "title", limit: 255
t.string "title"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
@ -211,10 +211,10 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", limit: 255, null: false
t.integer "sluggable_id", null: false
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope", limit: 255
t.string "scope"
t.datetime "created_at"
end
@ -224,10 +224,10 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
create_table "groups", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.boolean "disabled"
end
@ -246,7 +246,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "invoice_items", force: :cascade do |t|
t.integer "invoice_id"
t.string "stp_invoice_item_id", limit: 255
t.string "stp_invoice_item_id"
t.integer "amount"
t.datetime "created_at"
t.datetime "updated_at"
@ -260,17 +260,17 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "invoices", force: :cascade do |t|
t.integer "invoiced_id"
t.string "invoiced_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.string "invoiced_type"
t.string "stp_invoice_id"
t.integer "total"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
t.string "reference", limit: 255
t.string "avoir_mode", limit: 255
t.string "reference"
t.string "avoir_mode"
t.datetime "avoir_date"
t.integer "invoice_id"
t.string "type", limit: 255
t.string "type"
t.boolean "subscription_to_expire"
t.text "description"
t.integer "wallet_amount"
@ -278,6 +278,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
t.integer "coupon_id"
t.string "footprint"
t.string "environment"
t.integer "operator_id"
end
add_index "invoices", ["coupon_id"], name: "index_invoices_on_coupon_id", using: :btree
@ -286,17 +287,17 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
create_table "licences", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.text "description"
end
create_table "machines", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.text "description"
t.text "spec"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.boolean "disabled"
end
@ -313,14 +314,14 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "notifications", force: :cascade do |t|
t.integer "receiver_id"
t.integer "attached_object_id"
t.string "attached_object_type", limit: 255
t.string "attached_object_type"
t.integer "notification_type_id"
t.boolean "is_read", default: false
t.boolean "is_read", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "receiver_type"
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
end
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
@ -389,20 +390,20 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
create_table "plans", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.integer "amount"
t.string "interval", limit: 255
t.string "interval"
t.integer "group_id"
t.string "stp_plan_id", limit: 255
t.string "stp_plan_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.text "description"
t.string "type"
t.string "base_name"
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.string "slug"
t.boolean "disabled"
end
@ -432,11 +433,11 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "profiles", force: :cascade do |t|
t.integer "user_id"
t.string "first_name", limit: 255
t.string "last_name", limit: 255
t.string "first_name"
t.string "last_name"
t.boolean "gender"
t.date "birthday"
t.string "phone", limit: 255
t.string "phone"
t.text "interest"
t.text "software_mastered"
t.datetime "created_at"
@ -466,7 +467,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "title", limit: 255
t.string "title"
t.integer "step_nb"
end
@ -477,27 +478,27 @@ ActiveRecord::Schema.define(version: 20190227143153) do
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_valid", default: false
t.string "valid_token", limit: 255
t.boolean "is_valid", default: false
t.string "valid_token"
end
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
create_table "projects", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "author_id"
t.text "tags"
t.integer "licence_id"
t.string "state", limit: 255
t.string "slug", limit: 255
t.string "state"
t.string "slug"
t.datetime "published_at"
end
add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
create_table "projects_components", force: :cascade do |t|
t.integer "project_id"
@ -537,19 +538,19 @@ ActiveRecord::Schema.define(version: 20190227143153) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "reservable_id"
t.string "reservable_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.string "reservable_type"
t.string "stp_invoice_id"
t.integer "nb_reserve_places"
end
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
create_table "roles", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.integer "resource_id"
t.string "resource_type", limit: 255
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -623,18 +624,18 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "statistic_fields", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
t.string "data_type", limit: 255
t.string "data_type"
end
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
create_table "statistic_graphs", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "chart_type", limit: 255
t.string "chart_type"
t.integer "limit"
t.datetime "created_at"
t.datetime "updated_at"
@ -643,17 +644,17 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
create_table "statistic_indices", force: :cascade do |t|
t.string "es_type_key", limit: 255
t.string "label", limit: 255
t.string "es_type_key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "table", default: true
t.boolean "ca", default: true
t.boolean "table", default: true
t.boolean "ca", default: true
end
create_table "statistic_sub_types", force: :cascade do |t|
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -670,8 +671,8 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "statistic_types", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.boolean "graph"
t.datetime "created_at"
t.datetime "updated_at"
@ -689,7 +690,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
create_table "subscriptions", force: :cascade do |t|
t.integer "plan_id"
t.integer "user_id"
t.string "stp_subscription_id", limit: 255
t.string "stp_subscription_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "expiration_date"
@ -708,7 +709,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "themes", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
end
create_table "tickets", force: :cascade do |t|
@ -723,13 +724,13 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
create_table "trainings", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.string "slug", limit: 255
t.string "slug"
t.text "description"
t.boolean "public_page", default: true
t.boolean "public_page", default: true
t.boolean "disabled"
end
@ -785,31 +786,31 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token", limit: 255
t.string "unconfirmed_email"
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_allow_contact", default: true
t.boolean "is_allow_contact", default: true
t.integer "group_id"
t.string "stp_customer_id", limit: 255
t.string "username", limit: 255
t.string "slug", limit: 255
t.boolean "is_active", default: true
t.string "stp_customer_id"
t.string "username"
t.string "slug"
t.boolean "is_active", default: true
t.string "provider"
t.string "uid"
t.string "auth_token"
@ -882,6 +883,7 @@ ActiveRecord::Schema.define(version: 20190227143153) do
add_foreign_key "history_values", "settings"
add_foreign_key "history_values", "users"
add_foreign_key "invoices", "coupons"
add_foreign_key "invoices", "users", column: "operator_id"
add_foreign_key "invoices", "wallet_transactions"
add_foreign_key "o_auth2_mappings", "o_auth2_providers"
add_foreign_key "open_api_calls_count_tracings", "open_api_clients"