smartkiosk-server 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +32 -0
- data/.rspec +1 -0
- data/Capfile +4 -0
- data/Gemfile +71 -0
- data/Gemfile.lock +439 -0
- data/Guardfile +25 -0
- data/LICENSE +287 -0
- data/README.md +13 -0
- data/Rakefile +5 -0
- data/app/acquirers/cards_mkb_acquirer.rb +87 -0
- data/app/acquirers/cash_acquirer.rb +22 -0
- data/app/admin/agents.rb +108 -0
- data/app/admin/collections.rb +62 -0
- data/app/admin/commissions.rb +87 -0
- data/app/admin/gateways.rb +183 -0
- data/app/admin/limits.rb +82 -0
- data/app/admin/payments.rb +246 -0
- data/app/admin/provider_groups.rb +60 -0
- data/app/admin/provider_profiles.rb +11 -0
- data/app/admin/provider_receipt_templates.rb +82 -0
- data/app/admin/providers.rb +201 -0
- data/app/admin/rebates.rb +83 -0
- data/app/admin/report_results.rb +66 -0
- data/app/admin/report_templates.rb +209 -0
- data/app/admin/reports.rb +158 -0
- data/app/admin/revisions.rb +120 -0
- data/app/admin/system_receipt_templates.rb +76 -0
- data/app/admin/terminal_builds.rb +39 -0
- data/app/admin/terminal_profiles.rb +123 -0
- data/app/admin/terminals.rb +388 -0
- data/app/admin/users.rb +117 -0
- data/app/admin/versions.rb +131 -0
- data/app/admin/welcome.rb +64 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.eot +0 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.svg +6386 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.ttf +0 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.woff +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.eot +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.svg +5650 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.ttf +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.woff +0 -0
- data/app/assets/images/chosen-sprite.png +0 -0
- data/app/assets/javascripts/active_admin/chosen.js.erb.coffee +12 -0
- data/app/assets/javascripts/active_admin/qtip.js.coffee +22 -0
- data/app/assets/javascripts/active_admin/sortable_forms.js.coffee +14 -0
- data/app/assets/javascripts/active_admin.js.coffee +9 -0
- data/app/assets/javascripts/application.js +15 -0
- data/app/assets/javascripts/report_templates.js.coffee +10 -0
- data/app/assets/javascripts/terminals.js.coffee +12 -0
- data/app/assets/stylesheets/active_admin/PIE.css.scss +18 -0
- data/app/assets/stylesheets/active_admin/filter_numeric_range.css.scss +14 -0
- data/app/assets/stylesheets/active_admin/selectable_check_boxes.css.scss +12 -0
- data/app/assets/stylesheets/active_admin/sortable_forms.css.scss +11 -0
- data/app/assets/stylesheets/active_admin.css.scss +705 -0
- data/app/assets/stylesheets/fonts.css.scss +14 -0
- data/app/assets/stylesheets/provider_groups.css.scss +12 -0
- data/app/assets/stylesheets/provider_receipt_templates.css.scss +12 -0
- data/app/assets/stylesheets/terminals.css.scss +9 -0
- data/app/controllers/application_controller.rb +12 -0
- data/app/controllers/collections_controller.rb +10 -0
- data/app/controllers/payments_controller.rb +73 -0
- data/app/controllers/system_receipt_templates_controller.rb +10 -0
- data/app/controllers/terminal_builds_controller.rb +5 -0
- data/app/controllers/terminal_orders_controller.rb +25 -0
- data/app/controllers/terminal_pings_controller.rb +45 -0
- data/app/controllers/welcome_controller.rb +5 -0
- data/app/helpers/active_admin/report_templates_helper.rb +56 -0
- data/app/helpers/active_admin/views_helper.rb +20 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ability.rb +30 -0
- data/app/models/agent.rb +24 -0
- data/app/models/collection.rb +65 -0
- data/app/models/commission.rb +77 -0
- data/app/models/commission_section.rb +75 -0
- data/app/models/gateway.rb +99 -0
- data/app/models/gateway_attachment.rb +9 -0
- data/app/models/gateway_setting.rb +7 -0
- data/app/models/gateway_switch.rb +7 -0
- data/app/models/limit.rb +77 -0
- data/app/models/limit_section.rb +58 -0
- data/app/models/payment.rb +322 -0
- data/app/models/provider.rb +59 -0
- data/app/models/provider_field.rb +7 -0
- data/app/models/provider_gateway.rb +47 -0
- data/app/models/provider_group.rb +45 -0
- data/app/models/provider_profile.rb +9 -0
- data/app/models/provider_rebate.rb +69 -0
- data/app/models/provider_receipt_template.rb +85 -0
- data/app/models/rebate.rb +84 -0
- data/app/models/report.rb +71 -0
- data/app/models/report_result.rb +11 -0
- data/app/models/report_template.rb +56 -0
- data/app/models/revision.rb +104 -0
- data/app/models/role.rb +48 -0
- data/app/models/system_receipt_template.rb +13 -0
- data/app/models/terminal.rb +126 -0
- data/app/models/terminal_build.rb +62 -0
- data/app/models/terminal_order.rb +42 -0
- data/app/models/terminal_ping.rb +120 -0
- data/app/models/terminal_profile.rb +51 -0
- data/app/models/terminal_profile_promotion.rb +18 -0
- data/app/models/terminal_profile_provider.rb +11 -0
- data/app/models/terminal_profile_provider_group.rb +19 -0
- data/app/models/user.rb +38 -0
- data/app/models/user_role.rb +45 -0
- data/app/reports/agents_report.rb +81 -0
- data/app/reports/collections_report.rb +151 -0
- data/app/reports/payments_report.rb +189 -0
- data/app/reports/terminals_report.rb +123 -0
- data/app/uploaders/file_uploader.rb +53 -0
- data/app/uploaders/icon_uploader.rb +15 -0
- data/app/uploaders/zip_uploader.rb +53 -0
- data/app/views/admin/gateways/providers.html.arb +10 -0
- data/app/views/admin/revisions/payments.html.arb +28 -0
- data/app/views/admin/terminal_profiles/_tree.html.haml +35 -0
- data/app/views/admin/terminal_profiles/sort.html.haml +21 -0
- data/app/views/admin/terminals/pings.html.arb +55 -0
- data/app/views/admin/terminals/upgrade_build.html.arb +30 -0
- data/app/views/layouts/application.html.erb +1 -0
- data/app/views/welcome/index.html.erb +25 -0
- data/app/workers/pay_worker.rb +11 -0
- data/app/workers/report_worker.rb +7 -0
- data/app/workers/revise_worker.rb +7 -0
- data/config/acquiring.yml +13 -0
- data/config/application.rb +75 -0
- data/config/boot.rb +6 -0
- data/config/database.yml +17 -0
- data/config/deploy/roundlake-passenger.rb +3 -0
- data/config/deploy/roundlake-trinidad.rb +3 -0
- data/config/deploy.rb +37 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +39 -0
- data/config/environments/production.rb +67 -0
- data/config/environments/test.rb +37 -0
- data/config/initializers/active_admin.rb +31 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/devise.rb +232 -0
- data/config/initializers/inflections.rb +15 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/money.rb +6 -0
- data/config/initializers/redis.rb +4 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/setup_rack.rb +1 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/active_admin.ru.yml +71 -0
- data/config/locales/activerecord.ru.yml +645 -0
- data/config/locales/devise.ru.yml +57 -0
- data/config/locales/ru.yml +33 -0
- data/config/locales/smartkiosk.gateways.ru.yml +241 -0
- data/config/locales/smartkiosk.hardware.ru.yml +38 -0
- data/config/locales/smartkiosk.reports.ru.yml +56 -0
- data/config/locales/smartkiosk.ru.yml +163 -0
- data/config/nginx.conf +9 -0
- data/config/redis.yml +9 -0
- data/config/routes.rb +48 -0
- data/config/schedule.rb +13 -0
- data/config/sidekiq.yml +5 -0
- data/config/trinidad.yml +6 -0
- data/config.ru +4 -0
- data/db/migrate/20120825083035_create_terminals.rb +47 -0
- data/db/migrate/20120825083305_create_payments.rb +51 -0
- data/db/migrate/20120827062618_devise_create_users.rb +50 -0
- data/db/migrate/20120827132621_create_admin_notes.rb +17 -0
- data/db/migrate/20120827132622_move_admin_notes_to_comments.rb +25 -0
- data/db/migrate/20120903193346_create_providers.rb +24 -0
- data/db/migrate/20120922075345_create_collections.rb +26 -0
- data/db/migrate/20120922080440_create_agents.rb +29 -0
- data/db/migrate/20120922081104_create_commissions.rb +10 -0
- data/db/migrate/20120927035841_create_gateways.rb +13 -0
- data/db/migrate/20120927040626_create_provider_gateways.rb +13 -0
- data/db/migrate/20120927091849_create_limits.rb +10 -0
- data/db/migrate/20120927164647_create_roles.rb +14 -0
- data/db/migrate/20121003131522_create_report_templates.rb +18 -0
- data/db/migrate/20121007135652_create_reports.rb +13 -0
- data/db/migrate/20121008073905_create_report_results.rb +10 -0
- data/db/migrate/20121017114538_create_gateway_settings.rb +12 -0
- data/db/migrate/20121017114556_create_gateway_attachments.rb +10 -0
- data/db/migrate/20121019132606_create_revisions.rb +19 -0
- data/db/migrate/20121023073501_create_gateway_switches.rb +10 -0
- data/db/migrate/20121112142743_create_terminal_orders.rb +13 -0
- data/db/migrate/20121118191553_create_versions.rb +19 -0
- data/db/migrate/20121125093414_create_system_receipt_templates.rb +9 -0
- data/db/migrate/20121127192257_create_terminal_builds.rb +10 -0
- data/db/migrate/20121212053441_create_rebates.rb +15 -0
- data/db/migrate/20121216143855_create_provider_receipt_templates.rb +9 -0
- data/db/migrate/20130101091100_create_terminal_profiles.rb +13 -0
- data/db/migrate/20130101091734_create_provider_rebates.rb +21 -0
- data/db/migrate/20130102164447_create_limit_sections.rb +14 -0
- data/db/migrate/20130102164503_create_commission_sections.rb +17 -0
- data/db/migrate/20130102171743_create_provider_profiles.rb +10 -0
- data/db/migrate/20130103152507_create_provider_fields.rb +17 -0
- data/db/migrate/20130103154526_create_provider_groups.rb +10 -0
- data/db/migrate/20130104063628_create_terminal_profile_providers.rb +11 -0
- data/db/migrate/20130104090957_create_terminal_profile_provider_groups.rb +11 -0
- data/db/migrate/20130108091644_create_terminal_profile_promotions.rb +10 -0
- data/db/schema.rb +489 -0
- data/db/seeds/receipt_templates/payment.txt +19 -0
- data/db/seeds/receipt_templates/system/balance.txt +13 -0
- data/db/seeds/receipt_templates/system/collection.txt +17 -0
- data/db/seeds/receipt_templates/system/touchtest.txt +15 -0
- data/db/seeds.rb +18 -0
- data/doc/README_FOR_APP +2 -0
- data/init.rb +1 -0
- data/lib/active_admin/cancan_integration.rb +81 -0
- data/lib/active_admin/form_builder_fix.rb +76 -0
- data/lib/active_admin/inputs/filter_date_range_input_fix.rb +24 -0
- data/lib/active_admin/inputs/filter_multiple_select_input.rb +18 -0
- data/lib/active_admin/inputs/filter_numeric_range_input.rb +31 -0
- data/lib/active_admin/resource_controller_fix.rb +23 -0
- data/lib/active_admin/views/pages/base_fix.rb +13 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/blueprints.rb +79 -0
- data/lib/date_expander.rb +38 -0
- data/lib/dav4rack/build_resource.rb +59 -0
- data/lib/formtastic/inputs/selectable_check_boxes.rb +39 -0
- data/lib/paper_trail/version_fix.rb +3 -0
- data/lib/report_builder.rb +88 -0
- data/lib/seeder.rb +103 -0
- data/lib/smartkiosk/server/version.rb +5 -0
- data/lib/smartkiosk/server.rb +35 -0
- data/lib/string_file.rb +12 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/db.rake +27 -0
- data/lib/tasks/dump.rake +53 -0
- data/lib/tasks/matrioshka.rake +16 -0
- data/log/.gitkeep +0 -0
- data/log/gateways/.gitkeep +0 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/robots.txt +5 -0
- data/script/rails +6 -0
- data/smartkiosk-server.gemspec +23 -0
- data/spec/controllers/collections_controller_spec.rb +32 -0
- data/spec/controllers/payments_controller_spec.rb +123 -0
- data/spec/controllers/system_receipt_templates_controller_spec.rb +5 -0
- data/spec/controllers/terminal_builds_controller_spec.rb +5 -0
- data/spec/controllers/terminal_orders_controller_spec.rb +32 -0
- data/spec/controllers/terminal_pings_controller_spec.rb +31 -0
- data/spec/spec_helper.rb +66 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/chosen.jquery.js +1026 -0
- data/vendor/assets/javascripts/datepicker-ru.jquery.js +21 -0
- data/vendor/assets/javascripts/nestedSortable.jquery.js +429 -0
- data/vendor/assets/javascripts/qtip.jquery.js +3403 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/chosen.jquery.css +397 -0
- data/vendor/assets/stylesheets/modules/PIE.htc +96 -0
- data/vendor/assets/stylesheets/qtip.jquery.css.scss +604 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +333 -0
data/config/sidekiq.yml
ADDED
data/config/trinidad.yml
ADDED
data/config.ru
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
class CreateTerminals < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :terminals do |t|
|
4
|
+
t.belongs_to :agent
|
5
|
+
t.belongs_to :terminal_profile
|
6
|
+
t.string :address
|
7
|
+
t.string :keyword
|
8
|
+
t.string :description
|
9
|
+
t.string :state, :default => 'unknown'
|
10
|
+
t.string :condition
|
11
|
+
t.datetime :notified_at
|
12
|
+
t.datetime :collected_at
|
13
|
+
t.datetime :issues_started_at
|
14
|
+
|
15
|
+
t.integer :foreign_id
|
16
|
+
|
17
|
+
t.string :sector
|
18
|
+
t.string :contact_name
|
19
|
+
t.string :contact_phone
|
20
|
+
t.string :contact_email
|
21
|
+
t.string :schedule
|
22
|
+
t.string :juristic_name
|
23
|
+
t.string :contract_number
|
24
|
+
t.string :manager
|
25
|
+
t.string :rent
|
26
|
+
t.string :rent_finish_date
|
27
|
+
t.string :collection_zone
|
28
|
+
t.string :check_phone_number
|
29
|
+
|
30
|
+
t.integer :printer_error
|
31
|
+
t.integer :cash_acceptor_error
|
32
|
+
t.integer :modem_error
|
33
|
+
t.string :version
|
34
|
+
|
35
|
+
t.boolean :has_adv_monitor, :null => false, :default => true
|
36
|
+
|
37
|
+
t.integer :incomplete_orders_count, :null => false, :default => 0
|
38
|
+
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index :terminals, :keyword
|
43
|
+
add_index :terminals, :state
|
44
|
+
add_index :terminals, :condition
|
45
|
+
add_index :terminals, :agent_id
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class CreatePayments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :payments do |t|
|
4
|
+
t.string :session_id
|
5
|
+
t.integer :foreign_id
|
6
|
+
t.belongs_to :agent
|
7
|
+
t.belongs_to :terminal
|
8
|
+
t.belongs_to :gateway
|
9
|
+
t.belongs_to :provider
|
10
|
+
t.belongs_to :corrected_payment
|
11
|
+
t.belongs_to :user
|
12
|
+
t.belongs_to :collection
|
13
|
+
t.belongs_to :revision
|
14
|
+
t.integer :payment_type
|
15
|
+
t.boolean :offline, :null => false, :default => false
|
16
|
+
t.string :account
|
17
|
+
t.text :fields
|
18
|
+
t.text :raw_fields
|
19
|
+
t.text :meta
|
20
|
+
t.string :currency, :null => false, :default => 'rur'
|
21
|
+
t.decimal :paid_amount, :precision => 38, :scale => 2
|
22
|
+
t.decimal :commission_amount, :precision => 38, :scale => 2
|
23
|
+
t.decimal :enrolled_amount, :precision => 38, :scale => 2
|
24
|
+
t.decimal :rebate_amount, :precision => 38, :scale => 2
|
25
|
+
t.string :state, :null => false, :default => 'new'
|
26
|
+
t.integer :gateway_error
|
27
|
+
t.string :gateway_provider_id
|
28
|
+
t.string :gateway_payment_id
|
29
|
+
t.datetime :hour
|
30
|
+
t.date :day
|
31
|
+
t.date :month
|
32
|
+
t.integer :source, :null => false, :default => 0
|
33
|
+
t.string :receipt_number
|
34
|
+
t.datetime :paid_at
|
35
|
+
|
36
|
+
t.string :card_number
|
37
|
+
t.string :card_number_hash
|
38
|
+
t.string :card_track1
|
39
|
+
t.string :card_track2
|
40
|
+
|
41
|
+
t.timestamps
|
42
|
+
end
|
43
|
+
|
44
|
+
add_index :payments, :state
|
45
|
+
add_index :payments, :agent_id
|
46
|
+
add_index :payments, :terminal_id
|
47
|
+
add_index :payments, :gateway_id
|
48
|
+
add_index :payments, :provider_id
|
49
|
+
add_index :payments, :created_at
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:users) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.string :email, :null => false, :default => ""
|
6
|
+
t.string :encrypted_password, :null => false, :default => ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, :default => 0
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
t.string :full_name
|
23
|
+
|
24
|
+
t.boolean :root, :null => false, :default => false
|
25
|
+
|
26
|
+
## Confirmable
|
27
|
+
# t.string :confirmation_token
|
28
|
+
# t.datetime :confirmed_at
|
29
|
+
# t.datetime :confirmation_sent_at
|
30
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
31
|
+
|
32
|
+
## Lockable
|
33
|
+
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
|
34
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
35
|
+
# t.datetime :locked_at
|
36
|
+
|
37
|
+
## Token authenticatable
|
38
|
+
# t.string :authentication_token
|
39
|
+
|
40
|
+
|
41
|
+
t.timestamps
|
42
|
+
end
|
43
|
+
|
44
|
+
add_index :users, :email, :unique => true
|
45
|
+
add_index :users, :reset_password_token, :unique => true
|
46
|
+
# add_index :users, :confirmation_token, :unique => true
|
47
|
+
# add_index :users, :unlock_token, :unique => true
|
48
|
+
# add_index :users, :authentication_token, :unique => true
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateAdminNotes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :admin_notes do |t|
|
4
|
+
t.string :resource_id, :null => false
|
5
|
+
t.string :resource_type, :null => false
|
6
|
+
t.references :admin_user, :polymorphic => true
|
7
|
+
t.text :body
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :admin_notes, [:resource_type, :resource_id]
|
11
|
+
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :admin_notes
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class MoveAdminNotesToComments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
remove_index :admin_notes, [:admin_user_type, :admin_user_id]
|
4
|
+
rename_table :admin_notes, :active_admin_comments
|
5
|
+
rename_column :active_admin_comments, :admin_user_type, :author_type
|
6
|
+
rename_column :active_admin_comments, :admin_user_id, :author_id
|
7
|
+
add_column :active_admin_comments, :namespace, :string
|
8
|
+
add_index :active_admin_comments, [:namespace]
|
9
|
+
add_index :active_admin_comments, [:author_type, :author_id]
|
10
|
+
|
11
|
+
# Update all the existing comments to the default namespace
|
12
|
+
say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
|
13
|
+
execute "UPDATE active_admin_comments SET namespace='#{ActiveAdmin.application.default_namespace}'"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
remove_index :active_admin_comments, :column => [:author_type, :author_id]
|
18
|
+
remove_index :active_admin_comments, :column => [:namespace]
|
19
|
+
remove_column :active_admin_comments, :namespace
|
20
|
+
rename_column :active_admin_comments, :author_id, :admin_user_id
|
21
|
+
rename_column :active_admin_comments, :author_type, :admin_user_type
|
22
|
+
rename_table :active_admin_comments, :admin_notes
|
23
|
+
add_index :admin_notes, [:admin_user_type, :admin_user_id]
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateProviders < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :providers do |t|
|
4
|
+
t.belongs_to :provider_profile
|
5
|
+
t.belongs_to :provider_group
|
6
|
+
t.string :title
|
7
|
+
t.string :keyword
|
8
|
+
t.string :juristic_name
|
9
|
+
t.string :inn
|
10
|
+
t.boolean :requires_print, :null => false, :default => true
|
11
|
+
t.integer :foreign_id
|
12
|
+
t.integer :provider_gateways_count, :default => 0
|
13
|
+
t.string :icon
|
14
|
+
t.string :support_phone
|
15
|
+
|
16
|
+
t.belongs_to :provider_receipt_template
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index :providers, :keyword, :unique => true
|
22
|
+
add_index :providers, :updated_at
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateCollections < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :collections do |t|
|
4
|
+
t.belongs_to :agent
|
5
|
+
t.belongs_to :terminal
|
6
|
+
t.integer :source, :null => false, :default => 0
|
7
|
+
t.boolean :reset_counters, :null => false, :default => true
|
8
|
+
t.integer :foreign_id
|
9
|
+
t.decimal :payments_sum, :precision => 38, :scale => 2
|
10
|
+
t.integer :payments_count
|
11
|
+
t.decimal :receipts_sum, :precision => 38, :scale => 2
|
12
|
+
t.decimal :approved_payments_sum, :precision => 38, :scale => 2
|
13
|
+
t.integer :approved_payments_count
|
14
|
+
t.decimal :cash_sum, :precision => 38, :scale => 2
|
15
|
+
t.integer :cash_payments_count
|
16
|
+
t.integer :cashless_payments_count
|
17
|
+
t.text :banknotes
|
18
|
+
t.text :session_ids
|
19
|
+
t.datetime :collected_at
|
20
|
+
t.datetime :hour
|
21
|
+
t.date :day
|
22
|
+
t.date :month
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class CreateAgents < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :agents do |t|
|
4
|
+
t.belongs_to :agent
|
5
|
+
t.string :title
|
6
|
+
|
7
|
+
t.integer :foreign_id
|
8
|
+
|
9
|
+
t.string :juristic_name
|
10
|
+
t.string :juristic_address_city
|
11
|
+
t.string :juristic_address_street
|
12
|
+
t.string :juristic_address_home
|
13
|
+
t.string :physical_address_city
|
14
|
+
t.string :physical_address_district
|
15
|
+
t.string :physical_address_subway
|
16
|
+
t.string :physical_address_street
|
17
|
+
t.string :physical_address_home
|
18
|
+
t.string :contact_name
|
19
|
+
t.string :contact_info
|
20
|
+
t.string :director_name
|
21
|
+
t.string :director_contact_info
|
22
|
+
t.string :bookkeeper_name
|
23
|
+
t.string :bookkeeper_contact_info
|
24
|
+
t.string :inn
|
25
|
+
t.string :support_phone
|
26
|
+
t.timestamps
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateGateways < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :gateways do |t|
|
4
|
+
t.string :title
|
5
|
+
t.string :keyword
|
6
|
+
t.string :payzilla
|
7
|
+
t.boolean :requires_revisions_moderation, :null => false, :default => false
|
8
|
+
t.integer :debug_level, :null => false, :default => 0
|
9
|
+
t.boolean :enabled, :null => false, :default => true
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateProviderGateways < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :provider_gateways do |t|
|
4
|
+
t.belongs_to :provider
|
5
|
+
t.belongs_to :gateway
|
6
|
+
t.integer :priority
|
7
|
+
t.string :gateway_provider_id
|
8
|
+
t.string :account_mapping
|
9
|
+
t.text :fields_mapping
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateReportTemplates < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :report_templates do |t|
|
4
|
+
t.string :kind
|
5
|
+
t.string :title
|
6
|
+
t.boolean :open, :null => false, :default => false
|
7
|
+
t.text :groupping, :null => false, :default => ''
|
8
|
+
t.text :fields
|
9
|
+
t.text :calculations
|
10
|
+
t.string :sorting
|
11
|
+
t.boolean :sort_desc, :null => false, :default => false
|
12
|
+
t.text :conditions
|
13
|
+
t.string :email
|
14
|
+
t.belongs_to :user
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateReports < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :reports do |t|
|
4
|
+
t.belongs_to :report_template
|
5
|
+
t.belongs_to :user
|
6
|
+
t.date :start
|
7
|
+
t.date :finish
|
8
|
+
t.string :state, :null => false, :default => 'new'
|
9
|
+
t.text :error
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateGatewaySettings < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :gateway_settings do |t|
|
4
|
+
t.belongs_to :gateway
|
5
|
+
t.string :keyword
|
6
|
+
t.text :value
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :gateway_settings, [:gateway_id, :keyword]
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateRevisions < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :revisions do |t|
|
4
|
+
t.belongs_to :gateway
|
5
|
+
t.date :date
|
6
|
+
t.string :state, :null => false, :default => 'new'
|
7
|
+
t.integer :error
|
8
|
+
t.decimal :paid_sum, :precision => 38, :scale => 2
|
9
|
+
t.decimal :enrolled_sum, :precision => 38, :scale => 2
|
10
|
+
t.decimal :commission_sum, :precision => 38, :scale => 2
|
11
|
+
t.integer :payments_count
|
12
|
+
t.boolean :moderated, :null => false, :default => false
|
13
|
+
t.string :data
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :revisions, :state
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateTerminalOrders < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :terminal_orders do |t|
|
4
|
+
t.belongs_to :terminal
|
5
|
+
t.string :keyword
|
6
|
+
t.text :args
|
7
|
+
t.string :state, :null => false, :default => 'new'
|
8
|
+
t.string :error
|
9
|
+
t.integer :percent
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateVersions < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :versions do |t|
|
4
|
+
t.string :item_type, :null => false
|
5
|
+
t.integer :item_id, :null => false
|
6
|
+
t.string :event, :null => false
|
7
|
+
t.string :whodunnit
|
8
|
+
t.text :object_changes
|
9
|
+
t.text :object
|
10
|
+
t.datetime :created_at
|
11
|
+
end
|
12
|
+
add_index :versions, [:item_type, :item_id]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
remove_index :versions, [:item_type, :item_id]
|
17
|
+
drop_table :versions
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateProviderRebates < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :provider_rebates do |t|
|
4
|
+
|
5
|
+
t.belongs_to :rebate
|
6
|
+
|
7
|
+
t.belongs_to :provider
|
8
|
+
t.boolean :requires_commission
|
9
|
+
t.integer :payment_type
|
10
|
+
|
11
|
+
t.decimal :min, :precision => 38, :scale => 2
|
12
|
+
t.decimal :max, :precision => 38, :scale => 2
|
13
|
+
|
14
|
+
t.decimal :min_percent_amount, :precision => 38, :scale => 2, :null => false, :default => 0.0
|
15
|
+
t.decimal :percent_fee, :precision => 38, :scale => 2
|
16
|
+
t.decimal :static_fee, :precision => 38, :scale => 2
|
17
|
+
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateLimitSections < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :limit_sections do |t|
|
4
|
+
t.belongs_to :limit
|
5
|
+
t.belongs_to :agent
|
6
|
+
t.belongs_to :terminal_profile
|
7
|
+
t.integer :payment_type
|
8
|
+
|
9
|
+
t.decimal :min, :precision => 38, :scale => 2
|
10
|
+
t.decimal :max, :precision => 38, :scale => 2
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateCommissionSections < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :commission_sections do |t|
|
4
|
+
t.belongs_to :commission
|
5
|
+
t.belongs_to :agent
|
6
|
+
t.belongs_to :terminal_profile
|
7
|
+
t.integer :payment_type
|
8
|
+
|
9
|
+
t.decimal :min, :precision => 38, :scale => 2
|
10
|
+
t.decimal :max, :precision => 38, :scale => 2
|
11
|
+
|
12
|
+
t.decimal :percent_fee, :precision => 38, :scale => 2, :null => false, :default => 0
|
13
|
+
t.decimal :static_fee, :precision => 38, :scale => 2, :null => false, :default => 0
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateProviderFields < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :provider_fields do |t|
|
4
|
+
t.belongs_to :provider
|
5
|
+
|
6
|
+
t.string :keyword
|
7
|
+
t.string :title
|
8
|
+
t.string :kind
|
9
|
+
t.string :mask
|
10
|
+
t.string :regexp
|
11
|
+
t.text :values
|
12
|
+
t.integer :priority
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|