smartkiosk-server 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. data/.gitignore +32 -0
  2. data/.rspec +1 -0
  3. data/Capfile +4 -0
  4. data/Gemfile +71 -0
  5. data/Gemfile.lock +439 -0
  6. data/Guardfile +25 -0
  7. data/LICENSE +287 -0
  8. data/README.md +13 -0
  9. data/Rakefile +5 -0
  10. data/app/acquirers/cards_mkb_acquirer.rb +87 -0
  11. data/app/acquirers/cash_acquirer.rb +22 -0
  12. data/app/admin/agents.rb +108 -0
  13. data/app/admin/collections.rb +62 -0
  14. data/app/admin/commissions.rb +87 -0
  15. data/app/admin/gateways.rb +183 -0
  16. data/app/admin/limits.rb +82 -0
  17. data/app/admin/payments.rb +246 -0
  18. data/app/admin/provider_groups.rb +60 -0
  19. data/app/admin/provider_profiles.rb +11 -0
  20. data/app/admin/provider_receipt_templates.rb +82 -0
  21. data/app/admin/providers.rb +201 -0
  22. data/app/admin/rebates.rb +83 -0
  23. data/app/admin/report_results.rb +66 -0
  24. data/app/admin/report_templates.rb +209 -0
  25. data/app/admin/reports.rb +158 -0
  26. data/app/admin/revisions.rb +120 -0
  27. data/app/admin/system_receipt_templates.rb +76 -0
  28. data/app/admin/terminal_builds.rb +39 -0
  29. data/app/admin/terminal_profiles.rb +123 -0
  30. data/app/admin/terminals.rb +388 -0
  31. data/app/admin/users.rb +117 -0
  32. data/app/admin/versions.rb +131 -0
  33. data/app/admin/welcome.rb +64 -0
  34. data/app/assets/fonts/PT_Sans-Web-Bold.eot +0 -0
  35. data/app/assets/fonts/PT_Sans-Web-Bold.svg +6386 -0
  36. data/app/assets/fonts/PT_Sans-Web-Bold.ttf +0 -0
  37. data/app/assets/fonts/PT_Sans-Web-Bold.woff +0 -0
  38. data/app/assets/fonts/PT_Sans-Web-Regular.eot +0 -0
  39. data/app/assets/fonts/PT_Sans-Web-Regular.svg +5650 -0
  40. data/app/assets/fonts/PT_Sans-Web-Regular.ttf +0 -0
  41. data/app/assets/fonts/PT_Sans-Web-Regular.woff +0 -0
  42. data/app/assets/images/chosen-sprite.png +0 -0
  43. data/app/assets/javascripts/active_admin/chosen.js.erb.coffee +12 -0
  44. data/app/assets/javascripts/active_admin/qtip.js.coffee +22 -0
  45. data/app/assets/javascripts/active_admin/sortable_forms.js.coffee +14 -0
  46. data/app/assets/javascripts/active_admin.js.coffee +9 -0
  47. data/app/assets/javascripts/application.js +15 -0
  48. data/app/assets/javascripts/report_templates.js.coffee +10 -0
  49. data/app/assets/javascripts/terminals.js.coffee +12 -0
  50. data/app/assets/stylesheets/active_admin/PIE.css.scss +18 -0
  51. data/app/assets/stylesheets/active_admin/filter_numeric_range.css.scss +14 -0
  52. data/app/assets/stylesheets/active_admin/selectable_check_boxes.css.scss +12 -0
  53. data/app/assets/stylesheets/active_admin/sortable_forms.css.scss +11 -0
  54. data/app/assets/stylesheets/active_admin.css.scss +705 -0
  55. data/app/assets/stylesheets/fonts.css.scss +14 -0
  56. data/app/assets/stylesheets/provider_groups.css.scss +12 -0
  57. data/app/assets/stylesheets/provider_receipt_templates.css.scss +12 -0
  58. data/app/assets/stylesheets/terminals.css.scss +9 -0
  59. data/app/controllers/application_controller.rb +12 -0
  60. data/app/controllers/collections_controller.rb +10 -0
  61. data/app/controllers/payments_controller.rb +73 -0
  62. data/app/controllers/system_receipt_templates_controller.rb +10 -0
  63. data/app/controllers/terminal_builds_controller.rb +5 -0
  64. data/app/controllers/terminal_orders_controller.rb +25 -0
  65. data/app/controllers/terminal_pings_controller.rb +45 -0
  66. data/app/controllers/welcome_controller.rb +5 -0
  67. data/app/helpers/active_admin/report_templates_helper.rb +56 -0
  68. data/app/helpers/active_admin/views_helper.rb +20 -0
  69. data/app/helpers/application_helper.rb +2 -0
  70. data/app/mailers/.gitkeep +0 -0
  71. data/app/models/.gitkeep +0 -0
  72. data/app/models/ability.rb +30 -0
  73. data/app/models/agent.rb +24 -0
  74. data/app/models/collection.rb +65 -0
  75. data/app/models/commission.rb +77 -0
  76. data/app/models/commission_section.rb +75 -0
  77. data/app/models/gateway.rb +99 -0
  78. data/app/models/gateway_attachment.rb +9 -0
  79. data/app/models/gateway_setting.rb +7 -0
  80. data/app/models/gateway_switch.rb +7 -0
  81. data/app/models/limit.rb +77 -0
  82. data/app/models/limit_section.rb +58 -0
  83. data/app/models/payment.rb +322 -0
  84. data/app/models/provider.rb +59 -0
  85. data/app/models/provider_field.rb +7 -0
  86. data/app/models/provider_gateway.rb +47 -0
  87. data/app/models/provider_group.rb +45 -0
  88. data/app/models/provider_profile.rb +9 -0
  89. data/app/models/provider_rebate.rb +69 -0
  90. data/app/models/provider_receipt_template.rb +85 -0
  91. data/app/models/rebate.rb +84 -0
  92. data/app/models/report.rb +71 -0
  93. data/app/models/report_result.rb +11 -0
  94. data/app/models/report_template.rb +56 -0
  95. data/app/models/revision.rb +104 -0
  96. data/app/models/role.rb +48 -0
  97. data/app/models/system_receipt_template.rb +13 -0
  98. data/app/models/terminal.rb +126 -0
  99. data/app/models/terminal_build.rb +62 -0
  100. data/app/models/terminal_order.rb +42 -0
  101. data/app/models/terminal_ping.rb +120 -0
  102. data/app/models/terminal_profile.rb +51 -0
  103. data/app/models/terminal_profile_promotion.rb +18 -0
  104. data/app/models/terminal_profile_provider.rb +11 -0
  105. data/app/models/terminal_profile_provider_group.rb +19 -0
  106. data/app/models/user.rb +38 -0
  107. data/app/models/user_role.rb +45 -0
  108. data/app/reports/agents_report.rb +81 -0
  109. data/app/reports/collections_report.rb +151 -0
  110. data/app/reports/payments_report.rb +189 -0
  111. data/app/reports/terminals_report.rb +123 -0
  112. data/app/uploaders/file_uploader.rb +53 -0
  113. data/app/uploaders/icon_uploader.rb +15 -0
  114. data/app/uploaders/zip_uploader.rb +53 -0
  115. data/app/views/admin/gateways/providers.html.arb +10 -0
  116. data/app/views/admin/revisions/payments.html.arb +28 -0
  117. data/app/views/admin/terminal_profiles/_tree.html.haml +35 -0
  118. data/app/views/admin/terminal_profiles/sort.html.haml +21 -0
  119. data/app/views/admin/terminals/pings.html.arb +55 -0
  120. data/app/views/admin/terminals/upgrade_build.html.arb +30 -0
  121. data/app/views/layouts/application.html.erb +1 -0
  122. data/app/views/welcome/index.html.erb +25 -0
  123. data/app/workers/pay_worker.rb +11 -0
  124. data/app/workers/report_worker.rb +7 -0
  125. data/app/workers/revise_worker.rb +7 -0
  126. data/config/acquiring.yml +13 -0
  127. data/config/application.rb +75 -0
  128. data/config/boot.rb +6 -0
  129. data/config/database.yml +17 -0
  130. data/config/deploy/roundlake-passenger.rb +3 -0
  131. data/config/deploy/roundlake-trinidad.rb +3 -0
  132. data/config/deploy.rb +37 -0
  133. data/config/environment.rb +5 -0
  134. data/config/environments/development.rb +39 -0
  135. data/config/environments/production.rb +67 -0
  136. data/config/environments/test.rb +37 -0
  137. data/config/initializers/active_admin.rb +31 -0
  138. data/config/initializers/backtrace_silencers.rb +7 -0
  139. data/config/initializers/devise.rb +232 -0
  140. data/config/initializers/inflections.rb +15 -0
  141. data/config/initializers/mime_types.rb +5 -0
  142. data/config/initializers/money.rb +6 -0
  143. data/config/initializers/redis.rb +4 -0
  144. data/config/initializers/secret_token.rb +7 -0
  145. data/config/initializers/session_store.rb +8 -0
  146. data/config/initializers/setup_rack.rb +1 -0
  147. data/config/initializers/wrap_parameters.rb +14 -0
  148. data/config/locales/active_admin.ru.yml +71 -0
  149. data/config/locales/activerecord.ru.yml +645 -0
  150. data/config/locales/devise.ru.yml +57 -0
  151. data/config/locales/ru.yml +33 -0
  152. data/config/locales/smartkiosk.gateways.ru.yml +241 -0
  153. data/config/locales/smartkiosk.hardware.ru.yml +38 -0
  154. data/config/locales/smartkiosk.reports.ru.yml +56 -0
  155. data/config/locales/smartkiosk.ru.yml +163 -0
  156. data/config/nginx.conf +9 -0
  157. data/config/redis.yml +9 -0
  158. data/config/routes.rb +48 -0
  159. data/config/schedule.rb +13 -0
  160. data/config/sidekiq.yml +5 -0
  161. data/config/trinidad.yml +6 -0
  162. data/config.ru +4 -0
  163. data/db/migrate/20120825083035_create_terminals.rb +47 -0
  164. data/db/migrate/20120825083305_create_payments.rb +51 -0
  165. data/db/migrate/20120827062618_devise_create_users.rb +50 -0
  166. data/db/migrate/20120827132621_create_admin_notes.rb +17 -0
  167. data/db/migrate/20120827132622_move_admin_notes_to_comments.rb +25 -0
  168. data/db/migrate/20120903193346_create_providers.rb +24 -0
  169. data/db/migrate/20120922075345_create_collections.rb +26 -0
  170. data/db/migrate/20120922080440_create_agents.rb +29 -0
  171. data/db/migrate/20120922081104_create_commissions.rb +10 -0
  172. data/db/migrate/20120927035841_create_gateways.rb +13 -0
  173. data/db/migrate/20120927040626_create_provider_gateways.rb +13 -0
  174. data/db/migrate/20120927091849_create_limits.rb +10 -0
  175. data/db/migrate/20120927164647_create_roles.rb +14 -0
  176. data/db/migrate/20121003131522_create_report_templates.rb +18 -0
  177. data/db/migrate/20121007135652_create_reports.rb +13 -0
  178. data/db/migrate/20121008073905_create_report_results.rb +10 -0
  179. data/db/migrate/20121017114538_create_gateway_settings.rb +12 -0
  180. data/db/migrate/20121017114556_create_gateway_attachments.rb +10 -0
  181. data/db/migrate/20121019132606_create_revisions.rb +19 -0
  182. data/db/migrate/20121023073501_create_gateway_switches.rb +10 -0
  183. data/db/migrate/20121112142743_create_terminal_orders.rb +13 -0
  184. data/db/migrate/20121118191553_create_versions.rb +19 -0
  185. data/db/migrate/20121125093414_create_system_receipt_templates.rb +9 -0
  186. data/db/migrate/20121127192257_create_terminal_builds.rb +10 -0
  187. data/db/migrate/20121212053441_create_rebates.rb +15 -0
  188. data/db/migrate/20121216143855_create_provider_receipt_templates.rb +9 -0
  189. data/db/migrate/20130101091100_create_terminal_profiles.rb +13 -0
  190. data/db/migrate/20130101091734_create_provider_rebates.rb +21 -0
  191. data/db/migrate/20130102164447_create_limit_sections.rb +14 -0
  192. data/db/migrate/20130102164503_create_commission_sections.rb +17 -0
  193. data/db/migrate/20130102171743_create_provider_profiles.rb +10 -0
  194. data/db/migrate/20130103152507_create_provider_fields.rb +17 -0
  195. data/db/migrate/20130103154526_create_provider_groups.rb +10 -0
  196. data/db/migrate/20130104063628_create_terminal_profile_providers.rb +11 -0
  197. data/db/migrate/20130104090957_create_terminal_profile_provider_groups.rb +11 -0
  198. data/db/migrate/20130108091644_create_terminal_profile_promotions.rb +10 -0
  199. data/db/schema.rb +489 -0
  200. data/db/seeds/receipt_templates/payment.txt +19 -0
  201. data/db/seeds/receipt_templates/system/balance.txt +13 -0
  202. data/db/seeds/receipt_templates/system/collection.txt +17 -0
  203. data/db/seeds/receipt_templates/system/touchtest.txt +15 -0
  204. data/db/seeds.rb +18 -0
  205. data/doc/README_FOR_APP +2 -0
  206. data/init.rb +1 -0
  207. data/lib/active_admin/cancan_integration.rb +81 -0
  208. data/lib/active_admin/form_builder_fix.rb +76 -0
  209. data/lib/active_admin/inputs/filter_date_range_input_fix.rb +24 -0
  210. data/lib/active_admin/inputs/filter_multiple_select_input.rb +18 -0
  211. data/lib/active_admin/inputs/filter_numeric_range_input.rb +31 -0
  212. data/lib/active_admin/resource_controller_fix.rb +23 -0
  213. data/lib/active_admin/views/pages/base_fix.rb +13 -0
  214. data/lib/assets/.gitkeep +0 -0
  215. data/lib/blueprints.rb +79 -0
  216. data/lib/date_expander.rb +38 -0
  217. data/lib/dav4rack/build_resource.rb +59 -0
  218. data/lib/formtastic/inputs/selectable_check_boxes.rb +39 -0
  219. data/lib/paper_trail/version_fix.rb +3 -0
  220. data/lib/report_builder.rb +88 -0
  221. data/lib/seeder.rb +103 -0
  222. data/lib/smartkiosk/server/version.rb +5 -0
  223. data/lib/smartkiosk/server.rb +35 -0
  224. data/lib/string_file.rb +12 -0
  225. data/lib/tasks/.gitkeep +0 -0
  226. data/lib/tasks/db.rake +27 -0
  227. data/lib/tasks/dump.rake +53 -0
  228. data/lib/tasks/matrioshka.rake +16 -0
  229. data/log/.gitkeep +0 -0
  230. data/log/gateways/.gitkeep +0 -0
  231. data/public/404.html +26 -0
  232. data/public/422.html +26 -0
  233. data/public/500.html +25 -0
  234. data/public/robots.txt +5 -0
  235. data/script/rails +6 -0
  236. data/smartkiosk-server.gemspec +23 -0
  237. data/spec/controllers/collections_controller_spec.rb +32 -0
  238. data/spec/controllers/payments_controller_spec.rb +123 -0
  239. data/spec/controllers/system_receipt_templates_controller_spec.rb +5 -0
  240. data/spec/controllers/terminal_builds_controller_spec.rb +5 -0
  241. data/spec/controllers/terminal_orders_controller_spec.rb +32 -0
  242. data/spec/controllers/terminal_pings_controller_spec.rb +31 -0
  243. data/spec/spec_helper.rb +66 -0
  244. data/vendor/assets/javascripts/.gitkeep +0 -0
  245. data/vendor/assets/javascripts/chosen.jquery.js +1026 -0
  246. data/vendor/assets/javascripts/datepicker-ru.jquery.js +21 -0
  247. data/vendor/assets/javascripts/nestedSortable.jquery.js +429 -0
  248. data/vendor/assets/javascripts/qtip.jquery.js +3403 -0
  249. data/vendor/assets/stylesheets/.gitkeep +0 -0
  250. data/vendor/assets/stylesheets/chosen.jquery.css +397 -0
  251. data/vendor/assets/stylesheets/modules/PIE.htc +96 -0
  252. data/vendor/assets/stylesheets/qtip.jquery.css.scss +604 -0
  253. data/vendor/plugins/.gitkeep +0 -0
  254. metadata +333 -0
@@ -0,0 +1,11 @@
1
+ class CreateTerminalProfileProviders < ActiveRecord::Migration
2
+ def change
3
+ create_table :terminal_profile_providers do |t|
4
+ t.belongs_to :terminal_profile
5
+ t.belongs_to :provider
6
+ t.string :icon
7
+ t.integer :priority, :nil => false, :default => 1000000
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateTerminalProfileProviderGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :term_prof_provider_groups do |t|
4
+ t.belongs_to :terminal_profile
5
+ t.belongs_to :provider_group
6
+ t.string :icon
7
+ t.integer :priority, :nil => false, :default => 1000000
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class CreateTerminalProfilePromotions < ActiveRecord::Migration
2
+ def change
3
+ create_table :terminal_profile_promotions do |t|
4
+ t.belongs_to :terminal_profile
5
+ t.belongs_to :provider
6
+ t.integer :priority
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,489 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130108091644) do
15
+
16
+ create_table "active_admin_comments", :force => true do |t|
17
+ t.string "resource_id", :null => false
18
+ t.string "resource_type", :null => false
19
+ t.integer "author_id"
20
+ t.string "author_type"
21
+ t.text "body"
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ t.string "namespace"
25
+ end
26
+
27
+ add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
28
+ add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
29
+ add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
30
+
31
+ create_table "agents", :force => true do |t|
32
+ t.integer "agent_id"
33
+ t.string "title"
34
+ t.integer "foreign_id"
35
+ t.string "juristic_name"
36
+ t.string "juristic_address_city"
37
+ t.string "juristic_address_street"
38
+ t.string "juristic_address_home"
39
+ t.string "physical_address_city"
40
+ t.string "physical_address_district"
41
+ t.string "physical_address_subway"
42
+ t.string "physical_address_street"
43
+ t.string "physical_address_home"
44
+ t.string "contact_name"
45
+ t.string "contact_info"
46
+ t.string "director_name"
47
+ t.string "director_contact_info"
48
+ t.string "bookkeeper_name"
49
+ t.string "bookkeeper_contact_info"
50
+ t.string "inn"
51
+ t.string "support_phone"
52
+ t.datetime "created_at", :null => false
53
+ t.datetime "updated_at", :null => false
54
+ end
55
+
56
+ create_table "collections", :force => true do |t|
57
+ t.integer "agent_id"
58
+ t.integer "terminal_id"
59
+ t.integer "source", :default => 0, :null => false
60
+ t.boolean "reset_counters", :default => true, :null => false
61
+ t.integer "foreign_id"
62
+ t.decimal "payments_sum", :precision => 38, :scale => 2
63
+ t.integer "payments_count"
64
+ t.decimal "receipts_sum", :precision => 38, :scale => 2
65
+ t.decimal "approved_payments_sum", :precision => 38, :scale => 2
66
+ t.integer "approved_payments_count"
67
+ t.decimal "cash_sum", :precision => 38, :scale => 2
68
+ t.integer "cash_payments_count"
69
+ t.integer "cashless_payments_count"
70
+ t.text "banknotes"
71
+ t.text "session_ids"
72
+ t.datetime "collected_at"
73
+ t.datetime "hour"
74
+ t.date "day"
75
+ t.date "month"
76
+ t.datetime "created_at", :null => false
77
+ t.datetime "updated_at", :null => false
78
+ end
79
+
80
+ create_table "commission_sections", :force => true do |t|
81
+ t.integer "commission_id"
82
+ t.integer "agent_id"
83
+ t.integer "terminal_profile_id"
84
+ t.integer "payment_type"
85
+ t.decimal "min", :precision => 38, :scale => 2
86
+ t.decimal "max", :precision => 38, :scale => 2
87
+ t.decimal "percent_fee", :precision => 38, :scale => 2, :default => 0.0, :null => false
88
+ t.decimal "static_fee", :precision => 38, :scale => 2, :default => 0.0, :null => false
89
+ t.datetime "created_at", :null => false
90
+ t.datetime "updated_at", :null => false
91
+ end
92
+
93
+ create_table "commissions", :force => true do |t|
94
+ t.integer "provider_profile_id"
95
+ t.date "start"
96
+ t.date "finish"
97
+ t.datetime "created_at", :null => false
98
+ t.datetime "updated_at", :null => false
99
+ end
100
+
101
+ create_table "gateway_attachments", :force => true do |t|
102
+ t.integer "gateway_id"
103
+ t.string "keyword"
104
+ t.string "value"
105
+ t.datetime "created_at", :null => false
106
+ t.datetime "updated_at", :null => false
107
+ end
108
+
109
+ create_table "gateway_settings", :force => true do |t|
110
+ t.integer "gateway_id"
111
+ t.string "keyword"
112
+ t.text "value"
113
+ t.datetime "created_at", :null => false
114
+ t.datetime "updated_at", :null => false
115
+ end
116
+
117
+ add_index "gateway_settings", ["gateway_id", "keyword"], :name => "index_gateway_settings_on_gateway_id_and_keyword"
118
+
119
+ create_table "gateway_switches", :force => true do |t|
120
+ t.integer "gateway_id"
121
+ t.string "keyword"
122
+ t.boolean "value", :default => false, :null => false
123
+ t.datetime "created_at", :null => false
124
+ t.datetime "updated_at", :null => false
125
+ end
126
+
127
+ create_table "gateways", :force => true do |t|
128
+ t.string "title"
129
+ t.string "keyword"
130
+ t.string "payzilla"
131
+ t.boolean "requires_revisions_moderation", :default => false, :null => false
132
+ t.integer "debug_level", :default => 0, :null => false
133
+ t.boolean "enabled", :default => true, :null => false
134
+ t.datetime "created_at", :null => false
135
+ t.datetime "updated_at", :null => false
136
+ end
137
+
138
+ create_table "limit_sections", :force => true do |t|
139
+ t.integer "limit_id"
140
+ t.integer "agent_id"
141
+ t.integer "terminal_profile_id"
142
+ t.integer "payment_type"
143
+ t.decimal "min", :precision => 38, :scale => 2
144
+ t.decimal "max", :precision => 38, :scale => 2
145
+ t.datetime "created_at", :null => false
146
+ t.datetime "updated_at", :null => false
147
+ end
148
+
149
+ create_table "limits", :force => true do |t|
150
+ t.integer "provider_profile_id"
151
+ t.date "start"
152
+ t.date "finish"
153
+ t.datetime "created_at", :null => false
154
+ t.datetime "updated_at", :null => false
155
+ end
156
+
157
+ create_table "payments", :force => true do |t|
158
+ t.string "session_id"
159
+ t.integer "foreign_id"
160
+ t.integer "agent_id"
161
+ t.integer "terminal_id"
162
+ t.integer "gateway_id"
163
+ t.integer "provider_id"
164
+ t.integer "corrected_payment_id"
165
+ t.integer "user_id"
166
+ t.integer "collection_id"
167
+ t.integer "revision_id"
168
+ t.integer "payment_type"
169
+ t.boolean "offline", :default => false, :null => false
170
+ t.string "account"
171
+ t.text "fields"
172
+ t.text "raw_fields"
173
+ t.text "meta"
174
+ t.string "currency", :default => "rur", :null => false
175
+ t.decimal "paid_amount", :precision => 38, :scale => 2
176
+ t.decimal "commission_amount", :precision => 38, :scale => 2
177
+ t.decimal "enrolled_amount", :precision => 38, :scale => 2
178
+ t.decimal "rebate_amount", :precision => 38, :scale => 2
179
+ t.string "state", :default => "new", :null => false
180
+ t.integer "gateway_error"
181
+ t.string "gateway_provider_id"
182
+ t.string "gateway_payment_id"
183
+ t.datetime "hour"
184
+ t.date "day"
185
+ t.date "month"
186
+ t.integer "source", :default => 0, :null => false
187
+ t.string "receipt_number"
188
+ t.datetime "paid_at"
189
+ t.string "card_number"
190
+ t.string "card_number_hash"
191
+ t.string "card_track1"
192
+ t.string "card_track2"
193
+ t.datetime "created_at", :null => false
194
+ t.datetime "updated_at", :null => false
195
+ end
196
+
197
+ add_index "payments", ["agent_id"], :name => "index_payments_on_agent_id"
198
+ add_index "payments", ["created_at"], :name => "index_payments_on_created_at"
199
+ add_index "payments", ["gateway_id"], :name => "index_payments_on_gateway_id"
200
+ add_index "payments", ["provider_id"], :name => "index_payments_on_provider_id"
201
+ add_index "payments", ["state"], :name => "index_payments_on_state"
202
+ add_index "payments", ["terminal_id"], :name => "index_payments_on_terminal_id"
203
+
204
+ create_table "provider_fields", :force => true do |t|
205
+ t.integer "provider_id"
206
+ t.string "keyword"
207
+ t.string "title"
208
+ t.string "kind"
209
+ t.string "mask"
210
+ t.string "regexp"
211
+ t.text "values"
212
+ t.integer "priority"
213
+ t.datetime "created_at", :null => false
214
+ t.datetime "updated_at", :null => false
215
+ end
216
+
217
+ create_table "provider_gateways", :force => true do |t|
218
+ t.integer "provider_id"
219
+ t.integer "gateway_id"
220
+ t.integer "priority"
221
+ t.string "gateway_provider_id"
222
+ t.string "account_mapping"
223
+ t.text "fields_mapping"
224
+ t.datetime "created_at", :null => false
225
+ t.datetime "updated_at", :null => false
226
+ end
227
+
228
+ create_table "provider_groups", :force => true do |t|
229
+ t.string "title"
230
+ t.string "icon"
231
+ t.integer "provider_group_id"
232
+ t.datetime "created_at", :null => false
233
+ t.datetime "updated_at", :null => false
234
+ end
235
+
236
+ create_table "provider_profiles", :force => true do |t|
237
+ t.string "title"
238
+ t.datetime "created_at", :null => false
239
+ t.datetime "updated_at", :null => false
240
+ end
241
+
242
+ create_table "provider_rebates", :force => true do |t|
243
+ t.integer "rebate_id"
244
+ t.integer "provider_id"
245
+ t.boolean "requires_commission"
246
+ t.integer "payment_type"
247
+ t.decimal "min", :precision => 38, :scale => 2
248
+ t.decimal "max", :precision => 38, :scale => 2
249
+ t.decimal "min_percent_amount", :precision => 38, :scale => 2, :default => 0.0, :null => false
250
+ t.decimal "percent_fee", :precision => 38, :scale => 2
251
+ t.decimal "static_fee", :precision => 38, :scale => 2
252
+ t.datetime "created_at", :null => false
253
+ t.datetime "updated_at", :null => false
254
+ end
255
+
256
+ create_table "provider_receipt_templates", :force => true do |t|
257
+ t.boolean "system", :default => false, :null => false
258
+ t.text "template"
259
+ t.datetime "created_at", :null => false
260
+ t.datetime "updated_at", :null => false
261
+ end
262
+
263
+ create_table "providers", :force => true do |t|
264
+ t.integer "provider_profile_id"
265
+ t.integer "provider_group_id"
266
+ t.string "title"
267
+ t.string "keyword"
268
+ t.string "juristic_name"
269
+ t.string "inn"
270
+ t.boolean "requires_print", :default => true, :null => false
271
+ t.integer "foreign_id"
272
+ t.integer "provider_gateways_count", :default => 0
273
+ t.string "icon"
274
+ t.string "support_phone"
275
+ t.integer "provider_receipt_template_id"
276
+ t.datetime "created_at", :null => false
277
+ t.datetime "updated_at", :null => false
278
+ end
279
+
280
+ add_index "providers", ["keyword"], :name => "index_providers_on_keyword", :unique => true
281
+ add_index "providers", ["updated_at"], :name => "index_providers_on_updated_at"
282
+
283
+ create_table "rebates", :force => true do |t|
284
+ t.integer "gateway_id"
285
+ t.decimal "period_fee"
286
+ t.integer "period_kind"
287
+ t.date "start"
288
+ t.date "finish"
289
+ t.datetime "created_at", :null => false
290
+ t.datetime "updated_at", :null => false
291
+ end
292
+
293
+ create_table "report_results", :force => true do |t|
294
+ t.integer "rows"
295
+ t.integer "report_id"
296
+ t.text "data"
297
+ t.datetime "created_at", :null => false
298
+ t.datetime "updated_at", :null => false
299
+ end
300
+
301
+ create_table "report_templates", :force => true do |t|
302
+ t.string "kind"
303
+ t.string "title"
304
+ t.boolean "open", :default => false, :null => false
305
+ t.text "groupping", :default => "", :null => false
306
+ t.text "fields"
307
+ t.text "calculations"
308
+ t.string "sorting"
309
+ t.boolean "sort_desc", :default => false, :null => false
310
+ t.text "conditions"
311
+ t.string "email"
312
+ t.integer "user_id"
313
+ t.datetime "created_at", :null => false
314
+ t.datetime "updated_at", :null => false
315
+ end
316
+
317
+ create_table "reports", :force => true do |t|
318
+ t.integer "report_template_id"
319
+ t.integer "user_id"
320
+ t.date "start"
321
+ t.date "finish"
322
+ t.string "state", :default => "new", :null => false
323
+ t.text "error"
324
+ t.datetime "created_at", :null => false
325
+ t.datetime "updated_at", :null => false
326
+ end
327
+
328
+ create_table "revisions", :force => true do |t|
329
+ t.integer "gateway_id"
330
+ t.date "date"
331
+ t.string "state", :default => "new", :null => false
332
+ t.integer "error"
333
+ t.decimal "paid_sum", :precision => 38, :scale => 2
334
+ t.decimal "enrolled_sum", :precision => 38, :scale => 2
335
+ t.decimal "commission_sum", :precision => 38, :scale => 2
336
+ t.integer "payments_count"
337
+ t.boolean "moderated", :default => false, :null => false
338
+ t.string "data"
339
+ t.datetime "created_at", :null => false
340
+ t.datetime "updated_at", :null => false
341
+ end
342
+
343
+ add_index "revisions", ["state"], :name => "index_revisions_on_state"
344
+
345
+ create_table "roles", :force => true do |t|
346
+ t.string "keyword"
347
+ t.datetime "created_at", :null => false
348
+ t.datetime "updated_at", :null => false
349
+ end
350
+
351
+ create_table "system_receipt_templates", :force => true do |t|
352
+ t.string "keyword"
353
+ t.text "template"
354
+ t.datetime "created_at", :null => false
355
+ t.datetime "updated_at", :null => false
356
+ end
357
+
358
+ create_table "term_prof_provider_groups", :force => true do |t|
359
+ t.integer "terminal_profile_id"
360
+ t.integer "provider_group_id"
361
+ t.string "icon"
362
+ t.integer "priority", :default => 1000000
363
+ t.datetime "created_at", :null => false
364
+ t.datetime "updated_at", :null => false
365
+ end
366
+
367
+ create_table "terminal_builds", :force => true do |t|
368
+ t.string "version"
369
+ t.string "source"
370
+ t.text "hashes"
371
+ t.datetime "created_at", :null => false
372
+ t.datetime "updated_at", :null => false
373
+ end
374
+
375
+ create_table "terminal_orders", :force => true do |t|
376
+ t.integer "terminal_id"
377
+ t.string "keyword"
378
+ t.text "args"
379
+ t.string "state", :default => "new", :null => false
380
+ t.string "error"
381
+ t.integer "percent"
382
+ t.datetime "created_at", :null => false
383
+ t.datetime "updated_at", :null => false
384
+ end
385
+
386
+ create_table "terminal_profile_promotions", :force => true do |t|
387
+ t.integer "terminal_profile_id"
388
+ t.integer "provider_id"
389
+ t.integer "priority"
390
+ t.datetime "created_at", :null => false
391
+ t.datetime "updated_at", :null => false
392
+ end
393
+
394
+ create_table "terminal_profile_providers", :force => true do |t|
395
+ t.integer "terminal_profile_id"
396
+ t.integer "provider_id"
397
+ t.string "icon"
398
+ t.integer "priority", :default => 1000000
399
+ t.datetime "created_at", :null => false
400
+ t.datetime "updated_at", :null => false
401
+ end
402
+
403
+ create_table "terminal_profiles", :force => true do |t|
404
+ t.string "title"
405
+ t.string "support_phone"
406
+ t.string "keyword"
407
+ t.string "logo"
408
+ t.datetime "created_at", :null => false
409
+ t.datetime "updated_at", :null => false
410
+ end
411
+
412
+ create_table "terminals", :force => true do |t|
413
+ t.integer "agent_id"
414
+ t.integer "terminal_profile_id"
415
+ t.string "address"
416
+ t.string "keyword"
417
+ t.string "description"
418
+ t.string "state", :default => "unknown"
419
+ t.string "condition"
420
+ t.datetime "notified_at"
421
+ t.datetime "collected_at"
422
+ t.datetime "issues_started_at"
423
+ t.integer "foreign_id"
424
+ t.string "sector"
425
+ t.string "contact_name"
426
+ t.string "contact_phone"
427
+ t.string "contact_email"
428
+ t.string "schedule"
429
+ t.string "juristic_name"
430
+ t.string "contract_number"
431
+ t.string "manager"
432
+ t.string "rent"
433
+ t.string "rent_finish_date"
434
+ t.string "collection_zone"
435
+ t.string "check_phone_number"
436
+ t.integer "printer_error"
437
+ t.integer "cash_acceptor_error"
438
+ t.integer "modem_error"
439
+ t.string "version"
440
+ t.boolean "has_adv_monitor", :default => true, :null => false
441
+ t.integer "incomplete_orders_count", :default => 0, :null => false
442
+ t.datetime "created_at", :null => false
443
+ t.datetime "updated_at", :null => false
444
+ end
445
+
446
+ add_index "terminals", ["agent_id"], :name => "index_terminals_on_agent_id"
447
+ add_index "terminals", ["condition"], :name => "index_terminals_on_condition"
448
+ add_index "terminals", ["keyword"], :name => "index_terminals_on_keyword"
449
+ add_index "terminals", ["state"], :name => "index_terminals_on_state"
450
+
451
+ create_table "user_roles", :force => true do |t|
452
+ t.integer "user_id"
453
+ t.integer "role_id"
454
+ t.text "priveleges"
455
+ end
456
+
457
+ create_table "users", :force => true do |t|
458
+ t.string "email", :default => "", :null => false
459
+ t.string "encrypted_password", :default => "", :null => false
460
+ t.string "reset_password_token"
461
+ t.datetime "reset_password_sent_at"
462
+ t.datetime "remember_created_at"
463
+ t.integer "sign_in_count", :default => 0
464
+ t.datetime "current_sign_in_at"
465
+ t.datetime "last_sign_in_at"
466
+ t.string "current_sign_in_ip"
467
+ t.string "last_sign_in_ip"
468
+ t.string "full_name"
469
+ t.boolean "root", :default => false, :null => false
470
+ t.datetime "created_at", :null => false
471
+ t.datetime "updated_at", :null => false
472
+ end
473
+
474
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
475
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
476
+
477
+ create_table "versions", :force => true do |t|
478
+ t.string "item_type", :null => false
479
+ t.integer "item_id", :null => false
480
+ t.string "event", :null => false
481
+ t.string "whodunnit"
482
+ t.text "object_changes"
483
+ t.text "object"
484
+ t.datetime "created_at"
485
+ end
486
+
487
+ add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id"
488
+
489
+ end
@@ -0,0 +1,19 @@
1
+ *********************************
2
+ ---------------------------------
3
+ Terminal: {{ terminal_keyword }}
4
+ Smartkiosk ltd.
5
+ Your long address could be here
6
+ ---------------------------------
7
+ {{ payment_paid_at }}
8
+ ---------------------------------
9
+ Currency: {{ payment_currency }}
10
+ Receipt: #{{ payment_id }}
11
+ Account: 12345678900123456789
12
+ Provider: {{ provider_title | truncate: 26 }}
13
+ {{ payment_account }}
14
+ ---------------------------------
15
+ Paid: {{ payment_paid_amount }}
16
+ Fee: {{ payment_commission_amount }}
17
+ Enroll: {{ payment_enrolled_amount }}
18
+ ---------------------------------
19
+ *********************************
@@ -0,0 +1,13 @@
1
+ *********************************
2
+ ---------------------------------
3
+ Terminal: {{ terminal_keyword }}
4
+ Smartkiosk ltd.
5
+ Your long address could be here
6
+ ---------------------------------
7
+ From: {{ period_start }}
8
+ To: {{ period_end }}
9
+ ---------------------------------
10
+ Receipt: #{{ id }}
11
+ Balance: {{ balance }}
12
+ ---------------------------------
13
+ *********************************
@@ -0,0 +1,17 @@
1
+ *********************************
2
+ ---------------------------------
3
+ Terminal: {{ terminal_keyword }}
4
+ Smartkiosk ltd.
5
+ Your long address could be here
6
+ ---------------------------------
7
+ From: {{ period_start }}
8
+ To: {{ period_end }}
9
+ ---------------------------------
10
+ Receipt: #{{ id }}
11
+ Balance: {{ balance }}
12
+ ---------------------------------
13
+ {% for banknote in banknotes %}
14
+ {{ banknote.nominal }} * {{ banknote.count }} = {{ banknote.product }}
15
+ {% endfor %}
16
+ ---------------------------------
17
+ *********************************
@@ -0,0 +1,15 @@
1
+ *********************************
2
+ ---------------------------------
3
+ Terminal: {{ terminal_keyword }}
4
+ Smartkiosk ltd.
5
+ Your long address could be here
6
+ ---------------------------------
7
+ {{ time }}
8
+ ---------------------------------
9
+ Zone 1: {{ zones['1'] }}
10
+ Zone 2: {{ zones['2'] }}
11
+ Zone 3: {{ zones['3'] }}
12
+ Zone 4: {{ zones['4'] }}
13
+ Zone 5: {{ zones['5'] }}
14
+ ---------------------------------
15
+ *********************************
data/db/seeds.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'seeder'
2
+
3
+ $seeder = Seeder.new
4
+
5
+ $seeder.seed_gateways
6
+ $seeder.seed_receipt_templates
7
+
8
+ $seeder.seed_terminal_profiles
9
+ $seeder.seed_test_terminals if ENV['SEED_TEST']
10
+ $seeder.seed_terminal 'LOCAL'
11
+
12
+ if ENV['SEED_TEST']
13
+ $seeder.seed_test_providers
14
+ $seeder.seed_test_terminal_profile_promotions
15
+ $seeder.seed_test_payments
16
+ end
17
+
18
+ $seeder.seed_engines
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'smartkiosk/server'