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/LICENSE
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
NOTE! This software is dual-licensed. It's free for personal use. You
|
2
|
+
are also free to incorporate its parts under GPL terms.
|
3
|
+
|
4
|
+
Commercial use under GPL license is prohibited.
|
5
|
+
|
6
|
+
|
7
|
+
-------------------------------------------------------
|
8
|
+
|
9
|
+
|
10
|
+
GNU GENERAL PUBLIC LICENSE
|
11
|
+
Version 2, June 1991
|
12
|
+
|
13
|
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
14
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
15
|
+
Everyone is permitted to copy and distribute verbatim copies
|
16
|
+
of this license document, but changing it is not allowed.
|
17
|
+
|
18
|
+
Preamble
|
19
|
+
|
20
|
+
The licenses for most software are designed to take away your
|
21
|
+
freedom to share and change it. By contrast, the GNU General Public
|
22
|
+
License is intended to guarantee your freedom to share and change free
|
23
|
+
software--to make sure the software is free for all its users. This
|
24
|
+
General Public License applies to most of the Free Software
|
25
|
+
Foundation's software and to any other program whose authors commit to
|
26
|
+
using it. (Some other Free Software Foundation software is covered by
|
27
|
+
the GNU Lesser General Public License instead.) You can apply it to
|
28
|
+
your programs, too.
|
29
|
+
|
30
|
+
When we speak of free software, we are referring to freedom, not
|
31
|
+
price. Our General Public Licenses are designed to make sure that you
|
32
|
+
have the freedom to distribute copies of free software (and charge for
|
33
|
+
this service if you wish), that you receive source code or can get it
|
34
|
+
if you want it, that you can change the software or use pieces of it
|
35
|
+
in new free programs; and that you know you can do these things.
|
36
|
+
|
37
|
+
To protect your rights, we need to make restrictions that forbid
|
38
|
+
anyone to deny you these rights or to ask you to surrender the rights.
|
39
|
+
These restrictions translate to certain responsibilities for you if you
|
40
|
+
distribute copies of the software, or if you modify it.
|
41
|
+
|
42
|
+
For example, if you distribute copies of such a program, whether
|
43
|
+
gratis or for a fee, you must give the recipients all the rights that
|
44
|
+
you have. You must make sure that they, too, receive or can get the
|
45
|
+
source code. And you must show them these terms so they know their
|
46
|
+
rights.
|
47
|
+
|
48
|
+
We protect your rights with two steps: (1) copyright the software, and
|
49
|
+
(2) offer you this license which gives you legal permission to copy,
|
50
|
+
distribute and/or modify the software.
|
51
|
+
|
52
|
+
Also, for each author's protection and ours, we want to make certain
|
53
|
+
that everyone understands that there is no warranty for this free
|
54
|
+
software. If the software is modified by someone else and passed on, we
|
55
|
+
want its recipients to know that what they have is not the original, so
|
56
|
+
that any problems introduced by others will not reflect on the original
|
57
|
+
authors' reputations.
|
58
|
+
|
59
|
+
Finally, any free program is threatened constantly by software
|
60
|
+
patents. We wish to avoid the danger that redistributors of a free
|
61
|
+
program will individually obtain patent licenses, in effect making the
|
62
|
+
program proprietary. To prevent this, we have made it clear that any
|
63
|
+
patent must be licensed for everyone's free use or not licensed at all.
|
64
|
+
|
65
|
+
The precise terms and conditions for copying, distribution and
|
66
|
+
modification follow.
|
67
|
+
|
68
|
+
GNU GENERAL PUBLIC LICENSE
|
69
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
70
|
+
|
71
|
+
0. This License applies to any program or other work which contains
|
72
|
+
a notice placed by the copyright holder saying it may be distributed
|
73
|
+
under the terms of this General Public License. The "Program", below,
|
74
|
+
refers to any such program or work, and a "work based on the Program"
|
75
|
+
means either the Program or any derivative work under copyright law:
|
76
|
+
that is to say, a work containing the Program or a portion of it,
|
77
|
+
either verbatim or with modifications and/or translated into another
|
78
|
+
language. (Hereinafter, translation is included without limitation in
|
79
|
+
the term "modification".) Each licensee is addressed as "you".
|
80
|
+
|
81
|
+
Activities other than copying, distribution and modification are not
|
82
|
+
covered by this License; they are outside its scope. The act of
|
83
|
+
running the Program is not restricted, and the output from the Program
|
84
|
+
is covered only if its contents constitute a work based on the
|
85
|
+
Program (independent of having been made by running the Program).
|
86
|
+
Whether that is true depends on what the Program does.
|
87
|
+
|
88
|
+
1. You may copy and distribute verbatim copies of the Program's
|
89
|
+
source code as you receive it, in any medium, provided that you
|
90
|
+
conspicuously and appropriately publish on each copy an appropriate
|
91
|
+
copyright notice and disclaimer of warranty; keep intact all the
|
92
|
+
notices that refer to this License and to the absence of any warranty;
|
93
|
+
and give any other recipients of the Program a copy of this License
|
94
|
+
along with the Program.
|
95
|
+
|
96
|
+
You may charge a fee for the physical act of transferring a copy, and
|
97
|
+
you may at your option offer warranty protection in exchange for a fee.
|
98
|
+
|
99
|
+
2. You may modify your copy or copies of the Program or any portion
|
100
|
+
of it, thus forming a work based on the Program, and copy and
|
101
|
+
distribute such modifications or work under the terms of Section 1
|
102
|
+
above, provided that you also meet all of these conditions:
|
103
|
+
|
104
|
+
a) You must cause the modified files to carry prominent notices
|
105
|
+
stating that you changed the files and the date of any change.
|
106
|
+
|
107
|
+
b) You must cause any work that you distribute or publish, that in
|
108
|
+
whole or in part contains or is derived from the Program or any
|
109
|
+
part thereof, to be licensed as a whole at no charge to all third
|
110
|
+
parties under the terms of this License.
|
111
|
+
|
112
|
+
c) If the modified program normally reads commands interactively
|
113
|
+
when run, you must cause it, when started running for such
|
114
|
+
interactive use in the most ordinary way, to print or display an
|
115
|
+
announcement including an appropriate copyright notice and a
|
116
|
+
notice that there is no warranty (or else, saying that you provide
|
117
|
+
a warranty) and that users may redistribute the program under
|
118
|
+
these conditions, and telling the user how to view a copy of this
|
119
|
+
License. (Exception: if the Program itself is interactive but
|
120
|
+
does not normally print such an announcement, your work based on
|
121
|
+
the Program is not required to print an announcement.)
|
122
|
+
|
123
|
+
These requirements apply to the modified work as a whole. If
|
124
|
+
identifiable sections of that work are not derived from the Program,
|
125
|
+
and can be reasonably considered independent and separate works in
|
126
|
+
themselves, then this License, and its terms, do not apply to those
|
127
|
+
sections when you distribute them as separate works. But when you
|
128
|
+
distribute the same sections as part of a whole which is a work based
|
129
|
+
on the Program, the distribution of the whole must be on the terms of
|
130
|
+
this License, whose permissions for other licensees extend to the
|
131
|
+
entire whole, and thus to each and every part regardless of who wrote it.
|
132
|
+
|
133
|
+
Thus, it is not the intent of this section to claim rights or contest
|
134
|
+
your rights to work written entirely by you; rather, the intent is to
|
135
|
+
exercise the right to control the distribution of derivative or
|
136
|
+
collective works based on the Program.
|
137
|
+
|
138
|
+
In addition, mere aggregation of another work not based on the Program
|
139
|
+
with the Program (or with a work based on the Program) on a volume of
|
140
|
+
a storage or distribution medium does not bring the other work under
|
141
|
+
the scope of this License.
|
142
|
+
|
143
|
+
3. You may copy and distribute the Program (or a work based on it,
|
144
|
+
under Section 2) in object code or executable form under the terms of
|
145
|
+
Sections 1 and 2 above provided that you also do one of the following:
|
146
|
+
|
147
|
+
a) Accompany it with the complete corresponding machine-readable
|
148
|
+
source code, which must be distributed under the terms of Sections
|
149
|
+
1 and 2 above on a medium customarily used for software interchange; or,
|
150
|
+
|
151
|
+
b) Accompany it with a written offer, valid for at least three
|
152
|
+
years, to give any third party, for a charge no more than your
|
153
|
+
cost of physically performing source distribution, a complete
|
154
|
+
machine-readable copy of the corresponding source code, to be
|
155
|
+
distributed under the terms of Sections 1 and 2 above on a medium
|
156
|
+
customarily used for software interchange; or,
|
157
|
+
|
158
|
+
c) Accompany it with the information you received as to the offer
|
159
|
+
to distribute corresponding source code. (This alternative is
|
160
|
+
allowed only for noncommercial distribution and only if you
|
161
|
+
received the program in object code or executable form with such
|
162
|
+
an offer, in accord with Subsection b above.)
|
163
|
+
|
164
|
+
The source code for a work means the preferred form of the work for
|
165
|
+
making modifications to it. For an executable work, complete source
|
166
|
+
code means all the source code for all modules it contains, plus any
|
167
|
+
associated interface definition files, plus the scripts used to
|
168
|
+
control compilation and installation of the executable. However, as a
|
169
|
+
special exception, the source code distributed need not include
|
170
|
+
anything that is normally distributed (in either source or binary
|
171
|
+
form) with the major components (compiler, kernel, and so on) of the
|
172
|
+
operating system on which the executable runs, unless that component
|
173
|
+
itself accompanies the executable.
|
174
|
+
|
175
|
+
If distribution of executable or object code is made by offering
|
176
|
+
access to copy from a designated place, then offering equivalent
|
177
|
+
access to copy the source code from the same place counts as
|
178
|
+
distribution of the source code, even though third parties are not
|
179
|
+
compelled to copy the source along with the object code.
|
180
|
+
|
181
|
+
4. You may not copy, modify, sublicense, or distribute the Program
|
182
|
+
except as expressly provided under this License. Any attempt
|
183
|
+
otherwise to copy, modify, sublicense or distribute the Program is
|
184
|
+
void, and will automatically terminate your rights under this License.
|
185
|
+
However, parties who have received copies, or rights, from you under
|
186
|
+
this License will not have their licenses terminated so long as such
|
187
|
+
parties remain in full compliance.
|
188
|
+
|
189
|
+
5. You are not required to accept this License, since you have not
|
190
|
+
signed it. However, nothing else grants you permission to modify or
|
191
|
+
distribute the Program or its derivative works. These actions are
|
192
|
+
prohibited by law if you do not accept this License. Therefore, by
|
193
|
+
modifying or distributing the Program (or any work based on the
|
194
|
+
Program), you indicate your acceptance of this License to do so, and
|
195
|
+
all its terms and conditions for copying, distributing or modifying
|
196
|
+
the Program or works based on it.
|
197
|
+
|
198
|
+
6. Each time you redistribute the Program (or any work based on the
|
199
|
+
Program), the recipient automatically receives a license from the
|
200
|
+
original licensor to copy, distribute or modify the Program subject to
|
201
|
+
these terms and conditions. You may not impose any further
|
202
|
+
restrictions on the recipients' exercise of the rights granted herein.
|
203
|
+
You are not responsible for enforcing compliance by third parties to
|
204
|
+
this License.
|
205
|
+
|
206
|
+
7. If, as a consequence of a court judgment or allegation of patent
|
207
|
+
infringement or for any other reason (not limited to patent issues),
|
208
|
+
conditions are imposed on you (whether by court order, agreement or
|
209
|
+
otherwise) that contradict the conditions of this License, they do not
|
210
|
+
excuse you from the conditions of this License. If you cannot
|
211
|
+
distribute so as to satisfy simultaneously your obligations under this
|
212
|
+
License and any other pertinent obligations, then as a consequence you
|
213
|
+
may not distribute the Program at all. For example, if a patent
|
214
|
+
license would not permit royalty-free redistribution of the Program by
|
215
|
+
all those who receive copies directly or indirectly through you, then
|
216
|
+
the only way you could satisfy both it and this License would be to
|
217
|
+
refrain entirely from distribution of the Program.
|
218
|
+
|
219
|
+
If any portion of this section is held invalid or unenforceable under
|
220
|
+
any particular circumstance, the balance of the section is intended to
|
221
|
+
apply and the section as a whole is intended to apply in other
|
222
|
+
circumstances.
|
223
|
+
|
224
|
+
It is not the purpose of this section to induce you to infringe any
|
225
|
+
patents or other property right claims or to contest validity of any
|
226
|
+
such claims; this section has the sole purpose of protecting the
|
227
|
+
integrity of the free software distribution system, which is
|
228
|
+
implemented by public license practices. Many people have made
|
229
|
+
generous contributions to the wide range of software distributed
|
230
|
+
through that system in reliance on consistent application of that
|
231
|
+
system; it is up to the author/donor to decide if he or she is willing
|
232
|
+
to distribute software through any other system and a licensee cannot
|
233
|
+
impose that choice.
|
234
|
+
|
235
|
+
This section is intended to make thoroughly clear what is believed to
|
236
|
+
be a consequence of the rest of this License.
|
237
|
+
|
238
|
+
8. If the distribution and/or use of the Program is restricted in
|
239
|
+
certain countries either by patents or by copyrighted interfaces, the
|
240
|
+
original copyright holder who places the Program under this License
|
241
|
+
may add an explicit geographical distribution limitation excluding
|
242
|
+
those countries, so that distribution is permitted only in or among
|
243
|
+
countries not thus excluded. In such case, this License incorporates
|
244
|
+
the limitation as if written in the body of this License.
|
245
|
+
|
246
|
+
9. The Free Software Foundation may publish revised and/or new versions
|
247
|
+
of the General Public License from time to time. Such new versions will
|
248
|
+
be similar in spirit to the present version, but may differ in detail to
|
249
|
+
address new problems or concerns.
|
250
|
+
|
251
|
+
Each version is given a distinguishing version number. If the Program
|
252
|
+
specifies a version number of this License which applies to it and "any
|
253
|
+
later version", you have the option of following the terms and conditions
|
254
|
+
either of that version or of any later version published by the Free
|
255
|
+
Software Foundation. If the Program does not specify a version number of
|
256
|
+
this License, you may choose any version ever published by the Free Software
|
257
|
+
Foundation.
|
258
|
+
|
259
|
+
10. If you wish to incorporate parts of the Program into other free
|
260
|
+
programs whose distribution conditions are different, write to the author
|
261
|
+
to ask for permission. For software which is copyrighted by the Free
|
262
|
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
263
|
+
make exceptions for this. Our decision will be guided by the two goals
|
264
|
+
of preserving the free status of all derivatives of our free software and
|
265
|
+
of promoting the sharing and reuse of software generally.
|
266
|
+
|
267
|
+
NO WARRANTY
|
268
|
+
|
269
|
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
270
|
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
271
|
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
272
|
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
273
|
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
274
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
275
|
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
276
|
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
277
|
+
REPAIR OR CORRECTION.
|
278
|
+
|
279
|
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
280
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
281
|
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
282
|
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
283
|
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
284
|
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
285
|
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
286
|
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
287
|
+
POSSIBILITY OF SUCH DAMAGES.
|
data/README.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
## Smartkiosk: kiosk management software (server-side part)
|
2
|
+
|
3
|
+
Server side of Smartkiosk is just a Rails application. Clone it, migrate it,
|
4
|
+
seed it and you are ready to go.
|
5
|
+
|
6
|
+
## License
|
7
|
+
|
8
|
+
NOTE! This software is dual-licensed. It's free for personal use. You
|
9
|
+
are also free to incorporate its parts under GPL terms.
|
10
|
+
|
11
|
+
**Commercial use under GPL license is prohibited.**
|
12
|
+
|
13
|
+
Please get in touch if you require commercial usage.
|
data/Rakefile
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
class CardsMkbAcquirer
|
2
|
+
class << self
|
3
|
+
attr_reader :gateway
|
4
|
+
|
5
|
+
def ensure_running(config)
|
6
|
+
if @gateway.nil?
|
7
|
+
if !ISO8583::MKB::Logging.started?
|
8
|
+
ISO8583::MKB::Logging.start Rails.root.join('log/iso8583_mkb.log')
|
9
|
+
end
|
10
|
+
|
11
|
+
@gateway = ISO8583::MKB::SynchronousGateway.new(config)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def stop
|
16
|
+
@gateway.stop unless @gateway.nil?
|
17
|
+
@gateway = nil
|
18
|
+
ISO8583::MKB::Logging.stop
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Authorization
|
23
|
+
def initialize(auth)
|
24
|
+
@auth = auth
|
25
|
+
end
|
26
|
+
|
27
|
+
def success?
|
28
|
+
@auth.success?
|
29
|
+
end
|
30
|
+
|
31
|
+
def error
|
32
|
+
@auth.status_description
|
33
|
+
end
|
34
|
+
|
35
|
+
def confirm
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def reverse
|
40
|
+
reversal = @auth.reverse
|
41
|
+
# TODO: set reason code
|
42
|
+
|
43
|
+
CardsMkbAcquirer.gateway.execute reversal
|
44
|
+
# TODO: possibly report failure
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(config)
|
49
|
+
@config = config.with_indifferent_access
|
50
|
+
CardsMkbAcquirer.ensure_running @config
|
51
|
+
end
|
52
|
+
|
53
|
+
def authorize(payment)
|
54
|
+
auth = ISO8583::MKB::Authorization.new
|
55
|
+
auth.processing_code = @config[:processing_code]
|
56
|
+
auth.merchant_type = @config[:merchant_type]
|
57
|
+
auth.acquirer_country = @config[:acquirer_country]
|
58
|
+
auth.entry_mode = @config[:entry_mode]
|
59
|
+
auth.condition_code = @config[:condition_code]
|
60
|
+
auth.acquirer = @config[:acquirer]
|
61
|
+
auth.terminal_id = @config[:terminal_id]
|
62
|
+
auth.acceptor_id = @config[:acceptor_id]
|
63
|
+
|
64
|
+
auth.track2 = payment.card_track2
|
65
|
+
|
66
|
+
delimiter = auth.track2.index '='
|
67
|
+
auth.pan = auth.track2.slice(0, delimiter)
|
68
|
+
auth.expiry = auth.track2.slice(delimiter + 1, 4)
|
69
|
+
|
70
|
+
terminal = "OOOMKB TERM#{payment.terminal.keyword}"
|
71
|
+
city = "Moscow"
|
72
|
+
country = "RU"
|
73
|
+
|
74
|
+
auth.acceptor_name = sprintf("%-25s%-13s%-2s", terminal, city, country)
|
75
|
+
|
76
|
+
# TODO: implement currency handling
|
77
|
+
auth.amount = (payment.paid_amount * 100).to_i
|
78
|
+
auth.currency = 643
|
79
|
+
|
80
|
+
# TODO: build additional data
|
81
|
+
auth.additional = "USRDT, <cm>#{payment.commission_amount}</cm>, <ses>#{payment.session_id}</ses>backend data"
|
82
|
+
|
83
|
+
CardsMkbAcquirer.gateway.execute auth
|
84
|
+
|
85
|
+
Authorization.new auth
|
86
|
+
end
|
87
|
+
end
|
data/app/admin/agents.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
ActiveAdmin.register Agent do
|
2
|
+
|
3
|
+
menu :parent => I18n.t('activerecord.models.terminal.other'),
|
4
|
+
:if => proc { can? :index, Agent }
|
5
|
+
|
6
|
+
#
|
7
|
+
# INDEX
|
8
|
+
#
|
9
|
+
scope I18n.t('active_admin.all'), :all
|
10
|
+
scope I18n.t('activerecord.scopes.agent.root'), :root
|
11
|
+
|
12
|
+
filter :id
|
13
|
+
filter :agent, :as => 'multiple_select', :input_html => { :class => 'chosen' },
|
14
|
+
:collection => proc { Agent.rmap }
|
15
|
+
filter :title
|
16
|
+
filter :created_at
|
17
|
+
filter :updated_at
|
18
|
+
|
19
|
+
index do
|
20
|
+
selectable_column
|
21
|
+
column :id, :sortable => :id do |x|
|
22
|
+
link_to x.id, [:admin, x]
|
23
|
+
end
|
24
|
+
column :title
|
25
|
+
column :agent
|
26
|
+
column :created_at
|
27
|
+
column :updated_at
|
28
|
+
default_actions
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# SHOW
|
33
|
+
#
|
34
|
+
show do |agent|
|
35
|
+
attributes_table do
|
36
|
+
row :id
|
37
|
+
row :agent
|
38
|
+
row :title
|
39
|
+
row :terminals_count do |a|
|
40
|
+
a.terminals.count
|
41
|
+
end
|
42
|
+
row :juristic_name
|
43
|
+
row :juristic_address_city
|
44
|
+
row :juristic_address_street
|
45
|
+
row :juristic_address_home
|
46
|
+
row :physical_address_city
|
47
|
+
row :physical_address_district
|
48
|
+
row :physical_address_subway
|
49
|
+
row :physical_address_street
|
50
|
+
row :physical_address_home
|
51
|
+
row :contact_name
|
52
|
+
row :contact_info
|
53
|
+
row :director_name
|
54
|
+
row :director_contact_info
|
55
|
+
row :bookkeeper_name
|
56
|
+
row :bookkeeper_contact_info
|
57
|
+
row :inn
|
58
|
+
row :support_phone
|
59
|
+
row :created_at
|
60
|
+
row :updated_at
|
61
|
+
end
|
62
|
+
|
63
|
+
panel I18n.t('activerecord.models.payment.other') do
|
64
|
+
table_for(agent.payments.limit(20), :i18n => Payment) do |t|
|
65
|
+
t.column :terminal do |p|
|
66
|
+
unless p.terminal.blank?
|
67
|
+
link_to p.terminal.keyword, admin_terminal_path(p.terminal)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
t.column :paid_amount
|
71
|
+
t.column :provider
|
72
|
+
t.column :created_at
|
73
|
+
end
|
74
|
+
button(
|
75
|
+
link_to I18n.t('smartkiosk.full_list'),
|
76
|
+
admin_payments_path(:q => {:agent_id_eq => agent.id})
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
#
|
82
|
+
# FORM
|
83
|
+
#
|
84
|
+
form do |f|
|
85
|
+
f.inputs do
|
86
|
+
f.input :agent, :input_html => { :class => 'chosen' }
|
87
|
+
f.input :title
|
88
|
+
f.input :juristic_name
|
89
|
+
f.input :juristic_address_city
|
90
|
+
f.input :juristic_address_street
|
91
|
+
f.input :juristic_address_home
|
92
|
+
f.input :physical_address_city
|
93
|
+
f.input :physical_address_district
|
94
|
+
f.input :physical_address_subway
|
95
|
+
f.input :physical_address_street
|
96
|
+
f.input :physical_address_home
|
97
|
+
f.input :contact_name
|
98
|
+
f.input :contact_info
|
99
|
+
f.input :director_name
|
100
|
+
f.input :director_contact_info
|
101
|
+
f.input :bookkeeper_name
|
102
|
+
f.input :bookkeeper_contact_info
|
103
|
+
f.input :inn
|
104
|
+
f.input :support_phone
|
105
|
+
end
|
106
|
+
f.buttons
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
ActiveAdmin.register Collection do
|
2
|
+
config.batch_actions = false
|
3
|
+
actions :index, :show
|
4
|
+
|
5
|
+
menu :parent => I18n.t('activerecord.models.terminal.other'),
|
6
|
+
:if => proc { can? :index, Collection }
|
7
|
+
|
8
|
+
#
|
9
|
+
# INDEX
|
10
|
+
#
|
11
|
+
filter :id
|
12
|
+
filter :agent, :as => 'multiple_select', :input_html => { :class => 'chosen' },
|
13
|
+
:collection => proc { Agent.rmap }
|
14
|
+
filter :terminal, :as => 'multiple_select', :input_html => { :class => 'chosen' }
|
15
|
+
filter :cash_sum, :as => 'numeric_range'
|
16
|
+
filter :payments_sum, :as => 'numeric_range'
|
17
|
+
filter :approved_payments_sum, :as => 'numeric_range'
|
18
|
+
filter :payments_count, :as => 'numeric_range'
|
19
|
+
filter :cash_payments_count, :as => 'numeric_range'
|
20
|
+
filter :cashless_payments_count, :as => 'numeric_range'
|
21
|
+
filter :collected_at
|
22
|
+
|
23
|
+
index do
|
24
|
+
column :id, :sortable => :id do |x|
|
25
|
+
link_to x.id, [:admin, x]
|
26
|
+
end
|
27
|
+
column :collected_at
|
28
|
+
column :terminal
|
29
|
+
column :cash_sum
|
30
|
+
column :payments_sum
|
31
|
+
column :approved_payments_sum
|
32
|
+
column :difference do |x|
|
33
|
+
x.payments_sum - x.approved_payments_sum
|
34
|
+
end
|
35
|
+
default_actions
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# SHOW
|
40
|
+
#
|
41
|
+
show do
|
42
|
+
attributes_table do
|
43
|
+
row :id
|
44
|
+
row :collected_at
|
45
|
+
row :agent
|
46
|
+
row :terminal
|
47
|
+
row :cash_sum
|
48
|
+
row :payments_sum
|
49
|
+
row :approved_payments_sum
|
50
|
+
row :cash_payments_count
|
51
|
+
row :cashless_payments_count
|
52
|
+
row :payments_count
|
53
|
+
row :banknotes do |x|
|
54
|
+
if x.banknotes.is_a?(Hash)
|
55
|
+
x.banknotes.collect{|k,v| "<b>#{k}</b> — #{v}" }.join(', ').html_safe
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
active_admin_comments
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
ActiveAdmin.register Commission do
|
2
|
+
|
3
|
+
menu :parent => I18n.t('activerecord.models.provider.other'),
|
4
|
+
:if => proc { can? :index, Commission }
|
5
|
+
|
6
|
+
#
|
7
|
+
# INDEX
|
8
|
+
#
|
9
|
+
filter :id
|
10
|
+
filter :provider_profile, :as => 'multiple_select', :input_html => { :class => 'chosen' },
|
11
|
+
:collection => proc { ProviderProfile.rmap }
|
12
|
+
filter :provider_profile_providers_id, :as => 'multiple_select', :input_html => { :class => 'chosen' },
|
13
|
+
:collection => proc { Provider.rmap }
|
14
|
+
filter :start
|
15
|
+
filter :finish
|
16
|
+
filter :created_at
|
17
|
+
filter :updated_at
|
18
|
+
|
19
|
+
index do
|
20
|
+
selectable_column
|
21
|
+
column :id, :sortable => :id do |x|
|
22
|
+
link_to x.id, [:admin, x]
|
23
|
+
end
|
24
|
+
column :provider_profile
|
25
|
+
column :start
|
26
|
+
column :finish
|
27
|
+
default_actions
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# SHOW
|
32
|
+
#
|
33
|
+
show do
|
34
|
+
attributes_table do
|
35
|
+
row :provider_profile
|
36
|
+
row :start
|
37
|
+
row :finish
|
38
|
+
row :created_at
|
39
|
+
row :updated_at
|
40
|
+
end
|
41
|
+
|
42
|
+
panel I18n.t('activerecord.models.commission_section.other') do
|
43
|
+
table_for(commission.commission_sections, :i18n => CommissionSection) do |t|
|
44
|
+
t.column :agent
|
45
|
+
t.column :terminal_profile
|
46
|
+
t.column :payment_type
|
47
|
+
t.column :min
|
48
|
+
t.column :max
|
49
|
+
t.column :percent_fee
|
50
|
+
t.column :static_fee
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
active_admin_comments
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# FORM
|
59
|
+
#
|
60
|
+
form do |f|
|
61
|
+
f.semantic_errors
|
62
|
+
f.inputs do
|
63
|
+
f.input :provider_profile, :input_html => { :class => 'chosen' },
|
64
|
+
:collection => ProviderProfile.rmap
|
65
|
+
f.input :start, :as => :datepicker
|
66
|
+
f.input :finish, :as => :datepicker
|
67
|
+
end
|
68
|
+
f.inputs do
|
69
|
+
f.has_many :commission_sections do |csf|
|
70
|
+
csf.semantic_errors
|
71
|
+
csf.input :agent, :collection => Agent.rmap, :input_html => { :class => 'chosen' }
|
72
|
+
csf.input :terminal_profile, :collection => TerminalProfile.rmap, :input_html => { :class => 'chosen' }
|
73
|
+
csf.input :payment_type, :as => :select, :input_html => { :class => 'chosen' },
|
74
|
+
:collection => I18n.t('smartkiosk.payment_types').invert
|
75
|
+
csf.input :min
|
76
|
+
csf.input :max
|
77
|
+
csf.input :percent_fee
|
78
|
+
csf.input :static_fee
|
79
|
+
unless csf.object.new_record?
|
80
|
+
csf.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
|
81
|
+
end
|
82
|
+
csf.form_buffers.last
|
83
|
+
end
|
84
|
+
end
|
85
|
+
f.actions
|
86
|
+
end
|
87
|
+
end
|