smartkiosk-client 0.0.10 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile +1 -1
- data/app/controllers/payments.rb +28 -10
- data/app/controllers/terminal.rb +5 -18
- data/app/models/payment.rb +6 -2
- data/app/models/terminal.rb +18 -17
- data/app/workers/orders/acknowledge_worker.rb +0 -2
- data/app/workers/orders/complete_worker.rb +0 -2
- data/app/workers/orders/disable_worker.rb +0 -2
- data/app/workers/orders/durable_order_execution.rb +47 -0
- data/app/workers/orders/enable_worker.rb +0 -2
- data/app/workers/orders/reboot_worker.rb +4 -8
- data/app/workers/orders/reload_worker.rb +4 -8
- data/app/workers/orders/upgrade_worker.rb +4 -5
- data/app/workers/payments/check_worker.rb +6 -7
- data/app/workers/payments/collect_worker.rb +0 -2
- data/app/workers/payments/pay_worker.rb +10 -4
- data/app/workers/ping_worker.rb +0 -2
- data/app/workers/sync/icons_worker.rb +0 -2
- data/app/workers/sync/receipt_templates_worker.rb +0 -2
- data/bin/smartkiosk-client +31 -0
- data/config/boot.rb +10 -15
- data/db/migrate/20130106181548_create_payments.rb +4 -0
- data/lib/{smartkiosk → patches}/sidekiq.rb +0 -7
- data/lib/smartkiosk/client/logging.rb +4 -0
- data/lib/smartkiosk/client/version.rb +2 -2
- data/smartkiosk-client.gemspec +7 -5
- data/tmp/cache/.gitkeep +0 -0
- data/tmp/pids/.gitkeep +0 -0
- metadata +274 -109
- data/app/assets/flash/amqp.swf +0 -0
- data/app/assets/flash/expressInstall.swf +0 -0
- data/app/assets/javascripts/amqp.js +0 -18
- data/app/workers/startup_worker.rb +0 -11
- data/vendor/assets/javascripts/mq.js +0 -393
- data/vendor/assets/javascripts/swfobject.js +0 -4
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/app/controllers/payments.rb
CHANGED
@@ -1,30 +1,48 @@
|
|
1
1
|
class Application
|
2
2
|
post '/payments' do
|
3
3
|
payment = Payment.create! params[:payment]
|
4
|
+
|
4
5
|
json (payment.check ? payment.as_json : false)
|
5
6
|
end
|
6
7
|
|
7
|
-
post '/payments/:id/
|
8
|
+
post '/payments/:id/open_cash_acceptor' do
|
8
9
|
payment = Payment.find(params[:id])
|
9
10
|
Smartware.cash_acceptor.open(payment.limit.try('[]', :min), payment.limit.try('[]', :max))
|
10
|
-
|
11
|
+
|
12
|
+
json Smartware.cash_acceptor.error.blank?
|
11
13
|
end
|
12
14
|
|
13
|
-
post '/payments
|
14
|
-
payment = Payment.find(params[:id])
|
15
|
+
post '/payments/close_cash_acceptor' do
|
15
16
|
Smartware.cash_acceptor.close
|
16
|
-
payment.update_attributes :banknotes => Smartware.cash_acceptor.banknotes
|
17
|
-
payment.receipt.print
|
18
|
-
payment.pay
|
19
17
|
nil
|
20
18
|
end
|
21
19
|
|
22
|
-
|
23
|
-
|
20
|
+
post '/payments/open_card_reader' do
|
21
|
+
Smartware.card_reader.open
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
post '/payments/close_card_reader' do
|
26
|
+
Smartware.card_reader.close
|
27
|
+
nil
|
24
28
|
end
|
25
29
|
|
26
|
-
|
30
|
+
post '/payments/:id/pay' do
|
31
|
+
payment = Payment.find(params[:id])
|
27
32
|
Smartware.cash_acceptor.close
|
33
|
+
|
34
|
+
if payment.payment_type == 0
|
35
|
+
payment.update_attributes(:banknotes => Smartware.cash_acceptor.banknotes)
|
36
|
+
else
|
37
|
+
payment.update_attributes(
|
38
|
+
:paid_amount => params['payment']['paid_amount'],
|
39
|
+
:card_track1 => params['payment']['card_track1'],
|
40
|
+
:card_track2 => params['payment']['card_track2']
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
payment.receipt.print
|
45
|
+
payment.pay
|
28
46
|
nil
|
29
47
|
end
|
30
48
|
end
|
data/app/controllers/terminal.rb
CHANGED
@@ -4,20 +4,7 @@ Application.load 'lib/pinger'
|
|
4
4
|
|
5
5
|
class Application
|
6
6
|
get '/terminal' do
|
7
|
-
Terminal
|
8
|
-
|
9
|
-
result = {
|
10
|
-
:enabled => Terminal.enabled?,
|
11
|
-
:started_at => Terminal.started_at.value
|
12
|
-
}
|
13
|
-
|
14
|
-
modified_at = Terminal.actual_modified_at.change(:usec => 0)
|
15
|
-
|
16
|
-
if params[:modified_at] && (modified_at > DateTime.parse(params[:modified_at]))
|
17
|
-
result[:terminal] = Terminal.as_json
|
18
|
-
end
|
19
|
-
|
20
|
-
json result
|
7
|
+
json Terminal
|
21
8
|
end
|
22
9
|
|
23
10
|
get '/terminal/condition' do
|
@@ -48,22 +35,22 @@ class Application
|
|
48
35
|
|
49
36
|
post '/terminal/enable' do
|
50
37
|
Terminal.enable
|
51
|
-
json(:state => Terminal.
|
38
|
+
json(:state => Terminal.state)
|
52
39
|
end
|
53
40
|
|
54
41
|
post '/terminal/disable' do
|
55
42
|
Terminal.disable
|
56
|
-
json(:state => Terminal.
|
43
|
+
json(:state => Terminal.state)
|
57
44
|
end
|
58
45
|
|
59
46
|
post '/terminal/reload' do
|
60
47
|
Terminal.reload
|
61
|
-
json(:state => Terminal.
|
48
|
+
json(:state => Terminal.state)
|
62
49
|
end
|
63
50
|
|
64
51
|
post '/terminal/reboot' do
|
65
52
|
Terminal.reboot
|
66
|
-
json(:state => Terminal.
|
53
|
+
json(:state => Terminal.state)
|
67
54
|
end
|
68
55
|
|
69
56
|
get '/terminal/test_connection' do
|
data/app/models/payment.rb
CHANGED
@@ -13,10 +13,14 @@ class Payment < ActiveRecord::Base
|
|
13
13
|
serialize :banknotes
|
14
14
|
|
15
15
|
validates :provider, :presence => true
|
16
|
+
validates :payment_type, :presence => true
|
16
17
|
|
17
18
|
before_save do
|
18
19
|
if banknotes
|
19
20
|
self.paid_amount = banknotes.inject(0){|sum, (nominal, count)| sum + nominal.to_i*count.to_i }
|
21
|
+
end
|
22
|
+
|
23
|
+
if paid_amount
|
20
24
|
self.commission_amount = commission_for(self.paid_amount)
|
21
25
|
end
|
22
26
|
end
|
@@ -27,7 +31,7 @@ class Payment < ActiveRecord::Base
|
|
27
31
|
r.update_attributes :template => self.receipt_template,
|
28
32
|
:keyword => 'payment',
|
29
33
|
:fields => {
|
30
|
-
:recipient =>
|
34
|
+
:recipient => title,
|
31
35
|
:account => account,
|
32
36
|
:payment_paid_amount => paid_amount || 0,
|
33
37
|
:payment_enrolled_amount => ((paid_amount || 0) - (commission_amount || 0)).round(2),
|
@@ -50,7 +54,7 @@ class Payment < ActiveRecord::Base
|
|
50
54
|
end
|
51
55
|
|
52
56
|
def title
|
53
|
-
provider.title
|
57
|
+
provider.title rescue "-"
|
54
58
|
end
|
55
59
|
|
56
60
|
def commission_for(amount)
|
data/app/models/terminal.rb
CHANGED
@@ -1,25 +1,22 @@
|
|
1
1
|
require 'smartware'
|
2
|
+
require 'smartguard'
|
2
3
|
require 'socket'
|
3
4
|
require 'redis'
|
4
5
|
require 'redis/objects'
|
6
|
+
require 'file-tail'
|
5
7
|
|
6
8
|
Application.load 'lib/smartkiosk/config/yaml'
|
7
9
|
|
8
10
|
class Terminal
|
9
11
|
include Redis::Objects
|
10
12
|
|
11
|
-
value :
|
12
|
-
value :started_at, :global => true, :marshal => true
|
13
|
+
value :actual_state, :global => true
|
13
14
|
value :modified_at, :global => true, :marshal => true
|
14
15
|
value :payment_in_progress, :global => true
|
15
16
|
|
16
17
|
value :support_phone, :global => true
|
17
18
|
value :providers_updates, :global => true, :marshal => true
|
18
19
|
|
19
|
-
def self.smartguard
|
20
|
-
DRbObject.new_with_uri(Terminal.config.smartguard_host)
|
21
|
-
end
|
22
|
-
|
23
20
|
#
|
24
21
|
# STATES
|
25
22
|
#
|
@@ -35,8 +32,12 @@ class Terminal
|
|
35
32
|
self.payment_in_progress.value == "true"
|
36
33
|
end
|
37
34
|
|
38
|
-
def self.
|
39
|
-
self.
|
35
|
+
def self.state
|
36
|
+
self.actual_state.value || 'active'
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.state=(value)
|
40
|
+
self.actual_state = value
|
40
41
|
end
|
41
42
|
|
42
43
|
def self.actual_modified_at
|
@@ -59,14 +60,11 @@ class Terminal
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def self.reload
|
62
|
-
|
63
|
+
Smartguard::Client.restart_async
|
63
64
|
end
|
64
65
|
|
65
66
|
def self.reboot
|
66
|
-
|
67
|
-
StartupWorker.perform_async self.name, :enable
|
68
|
-
|
69
|
-
smartguard.reboot_async
|
67
|
+
Smartguard::Client.reboot_async
|
70
68
|
end
|
71
69
|
|
72
70
|
#
|
@@ -81,7 +79,7 @@ class Terminal
|
|
81
79
|
end
|
82
80
|
|
83
81
|
def self.enabled?
|
84
|
-
self.
|
82
|
+
self.state == 'active'
|
85
83
|
end
|
86
84
|
|
87
85
|
def self.version
|
@@ -101,9 +99,8 @@ class Terminal
|
|
101
99
|
Socket.do_not_reverse_lookup = orig
|
102
100
|
end
|
103
101
|
|
104
|
-
def self.as_json
|
102
|
+
def self.as_json(*args)
|
105
103
|
{
|
106
|
-
:started_at => Terminal.started_at.value,
|
107
104
|
:modified_at => Terminal.actual_modified_at,
|
108
105
|
:keyword => Terminal.keyword,
|
109
106
|
:support_phone => Terminal.support_phone.value,
|
@@ -113,10 +110,14 @@ class Terminal
|
|
113
110
|
}
|
114
111
|
end
|
115
112
|
|
113
|
+
def self.to_json(*args)
|
114
|
+
as_json.to_json
|
115
|
+
end
|
116
|
+
|
116
117
|
def self.condition
|
117
118
|
{
|
118
119
|
:ip => ip,
|
119
|
-
:state => Terminal.
|
120
|
+
:state => Terminal.state,
|
120
121
|
:banknotes => Payment.merge_banknotes(Payment.uncollected),
|
121
122
|
:cash => Payment.merge_cash(Payment.uncollected),
|
122
123
|
:providers => {
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Orders
|
2
|
+
module DurableOrderExecution
|
3
|
+
def safely_execute_order(order_id, &block)
|
4
|
+
pid = Process.fork
|
5
|
+
return unless pid.nil?
|
6
|
+
|
7
|
+
Process.setsid
|
8
|
+
|
9
|
+
begin
|
10
|
+
Smartkiosk::Client::Logging.logger.debug "Started execution of order #{order_id}"
|
11
|
+
yield
|
12
|
+
Smartkiosk::Client::Logging.logger.debug "Completed execution of order #{order_id}"
|
13
|
+
|
14
|
+
rescue => e
|
15
|
+
Smartkiosk::Client::Logging.logger.debug "Execution of order #{order_id} failed: #{e}"
|
16
|
+
|
17
|
+
begin
|
18
|
+
AcknowledgeWorker.perform_async order_id, e.to_s
|
19
|
+
rescue => ne
|
20
|
+
Smartkiosk::Client::Logging.logger.debug "Unable to schedule AcknowlegeWorker #{ne}"
|
21
|
+
sleep 1
|
22
|
+
retry
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
CompleteWorker.perform_async order_id
|
28
|
+
rescue => ne
|
29
|
+
Smartkiosk::Client::Logging.logger.debug "Unable to schedule CompleteWorker: #{ne}"
|
30
|
+
sleep 1
|
31
|
+
retry
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
ActiveRecord::Base.connection.reconnect!
|
36
|
+
|
37
|
+
Order.find(order_id).update_attribute(:complete, true)
|
38
|
+
rescue => ne
|
39
|
+
Smartkiosk::Client::Logging.logger.debug "Unable to mark completion: #{ne}"
|
40
|
+
sleep 1
|
41
|
+
retry
|
42
|
+
end
|
43
|
+
|
44
|
+
Process.exit!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,18 +1,14 @@
|
|
1
|
-
Application.load 'lib/smartkiosk/sidekiq'
|
2
|
-
|
3
1
|
module Orders
|
4
2
|
class RebootWorker
|
5
3
|
include Sidekiq::Worker
|
4
|
+
include DurableOrderExecution
|
6
5
|
|
7
6
|
sidekiq_options :queue => :orders
|
8
7
|
|
9
8
|
def perform(order_id)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.finish(order_id)
|
15
|
-
Order.find(order_id).complete
|
9
|
+
safely_execute_order(order_id) do
|
10
|
+
Smartguard::Client.reboot
|
11
|
+
end
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
@@ -1,18 +1,14 @@
|
|
1
|
-
Application.load 'lib/smartkiosk/sidekiq'
|
2
|
-
|
3
1
|
module Orders
|
4
2
|
class ReloadWorker
|
5
3
|
include Sidekiq::Worker
|
4
|
+
include DurableOrderExecution
|
6
5
|
|
7
6
|
sidekiq_options :queue => :orders
|
8
7
|
|
9
8
|
def perform(order_id)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def self.finish(order_id)
|
15
|
-
Order.find(order_id).complete
|
9
|
+
safely_execute_order(order_id) do
|
10
|
+
Smartguard::Client.restart
|
11
|
+
end
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
@@ -2,11 +2,10 @@ require 'pathname'
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
Application.load 'lib/smartkiosk/sidekiq'
|
6
|
-
|
7
5
|
module Orders
|
8
6
|
class UpgradeWorker
|
9
7
|
include Sidekiq::Worker
|
8
|
+
include DurableOrderExecution
|
10
9
|
|
11
10
|
sidekiq_options :queue => :orders
|
12
11
|
|
@@ -19,12 +18,12 @@ module Orders
|
|
19
18
|
@base_url = URI.parse(order.args[3]).scheme.nil? ? "#{Terminal.config.host}#{order.args[3]}"
|
20
19
|
: order.args[3]
|
21
20
|
|
22
|
-
@releases_pathname =
|
21
|
+
@releases_pathname = Smartguard::Client.releases_path
|
23
22
|
@build_pathname = @releases_pathname.join @build_version.to_s
|
24
23
|
|
25
24
|
self.sync!
|
26
|
-
|
27
|
-
|
25
|
+
safely_execute_order(order_id) do
|
26
|
+
Smartguard::Client.switch_release @build_version.to_s.to_sym
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
|
3
|
-
Application.load 'lib/smartkiosk/sidekiq'
|
4
|
-
|
5
3
|
module Payments
|
6
4
|
class CheckWorker
|
7
5
|
include Sidekiq::Worker
|
@@ -13,8 +11,9 @@ module Payments
|
|
13
11
|
response = RestClient.post "#{Terminal.config.host}/payments",
|
14
12
|
:provider => payment.provider.keyword,
|
15
13
|
:terminal => Terminal.config.keyword,
|
16
|
-
:payment => {
|
14
|
+
:payment => {
|
17
15
|
:account => payment.account,
|
16
|
+
:payment_type => payment.payment_type,
|
18
17
|
:fields => payment.fields,
|
19
18
|
:session_id => payment.id
|
20
19
|
}
|
@@ -22,11 +21,11 @@ module Payments
|
|
22
21
|
answer = JSON.parse(response.to_s, :symbolize_names => true)
|
23
22
|
|
24
23
|
unless answer[:id].nil?
|
25
|
-
payment.update_attributes :foreign_id
|
26
|
-
:limit
|
27
|
-
:commissions
|
24
|
+
payment.update_attributes :foreign_id => answer[:id],
|
25
|
+
:limit => answer[:limits].sort_by(&:weight).last,
|
26
|
+
:commissions => (answer[:commissions].empty? ? nil : answer[:commissions]),
|
28
27
|
:receipt_template => answer[:receipt_template],
|
29
|
-
:checked
|
28
|
+
:checked => true
|
30
29
|
end
|
31
30
|
rescue => e
|
32
31
|
Payment.find(payment_id).update_attributes :error => true
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
|
3
|
-
Application.load 'lib/smartkiosk/sidekiq'
|
4
|
-
|
5
3
|
module Payments
|
6
4
|
class PayWorker
|
7
5
|
include Sidekiq::Worker
|
@@ -13,9 +11,17 @@ module Payments
|
|
13
11
|
response = RestClient.post "#{Terminal.config.host}/payments/#{payment.foreign_id}/pay",
|
14
12
|
:provider => payment.provider.keyword,
|
15
13
|
:terminal => Terminal.config.keyword,
|
16
|
-
:payment => {
|
14
|
+
:payment => {
|
15
|
+
:paid_amount => payment.paid_amount,
|
16
|
+
:card_track1 => payment.card_track1,
|
17
|
+
:card_track2 => payment.card_track2
|
18
|
+
}
|
17
19
|
Sidekiq::Logging.logger.debug "Pay response: #{response.to_s}"
|
18
|
-
payment.update_attributes(
|
20
|
+
payment.update_attributes(
|
21
|
+
:processed => true,
|
22
|
+
:card_track1 => nil,
|
23
|
+
:card_track2 => nil
|
24
|
+
) if response
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
data/app/workers/ping_worker.rb
CHANGED
data/bin/smartkiosk-client
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'bundler/setup'
|
4
4
|
require 'eventmachine'
|
5
|
+
require 'em-websocket'
|
5
6
|
require 'thin'
|
6
7
|
require 'trollop'
|
7
8
|
|
@@ -17,6 +18,9 @@ Smartkiosk::Client::Logging.destination = opts[:log] if opts[:log]
|
|
17
18
|
Smartkiosk::Client::Logging.init
|
18
19
|
|
19
20
|
EventMachine.run do
|
21
|
+
#
|
22
|
+
# Serving front
|
23
|
+
#
|
20
24
|
Thin::Server.start '0.0.0.0', 3001 do
|
21
25
|
map '/assets' do
|
22
26
|
run Application.sprockets
|
@@ -24,4 +28,31 @@ EventMachine.run do
|
|
24
28
|
use Smartkiosk::Client::Logging::Middleware
|
25
29
|
run Application
|
26
30
|
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Serving WebSockets
|
34
|
+
#
|
35
|
+
@front_orders = EM::Channel.new
|
36
|
+
|
37
|
+
EventMachine.add_periodic_timer 1 do
|
38
|
+
@front_orders.push ['state', Terminal.state].to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
EventMachine.add_periodic_timer 5 do
|
42
|
+
@front_orders.push ['modified_at', Terminal.modified_at].to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
Smartware.subscribe do |key, *value|
|
46
|
+
@front_orders.push ["smartware.#{key}", value].to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
EventMachine::WebSocket.run(:host => '0.0.0.0', :port => 3002) do |ws|
|
50
|
+
ws.onopen {
|
51
|
+
sid = @front_orders.subscribe { |msg| ws.send msg }
|
52
|
+
|
53
|
+
ws.onclose {
|
54
|
+
@front_orders.unsubscribe(sid)
|
55
|
+
}
|
56
|
+
}
|
57
|
+
end
|
27
58
|
end
|
data/config/boot.rb
CHANGED
@@ -9,7 +9,6 @@ require 'sprockets/helpers'
|
|
9
9
|
require 'sinatra/base'
|
10
10
|
require 'sinatra/activerecord'
|
11
11
|
require 'sinatra/reloader'
|
12
|
-
require 'sinatra/json'
|
13
12
|
|
14
13
|
module Smartkiosk
|
15
14
|
class Client < Sinatra::Base
|
@@ -25,6 +24,7 @@ module Smartkiosk
|
|
25
24
|
set :sprockets, Sprockets::Environment.new(root)
|
26
25
|
set :database_file, root.join('config/services/database.yml')
|
27
26
|
set :views, [File.expand_path('../../app/views', __FILE__)]
|
27
|
+
set :logging, nil
|
28
28
|
|
29
29
|
assets_types.map do |x|
|
30
30
|
sprockets.append_path root.join("app/assets/#{x}")
|
@@ -61,32 +61,28 @@ module Smartkiosk
|
|
61
61
|
data.to_json
|
62
62
|
end
|
63
63
|
|
64
|
-
get "/assets/*" do
|
65
|
-
env["PATH_INFO"].sub!(%r{^/assets}, "")
|
66
|
-
settings.sprockets.call(env)
|
67
|
-
end
|
68
|
-
|
69
64
|
def self.load(path)
|
70
65
|
require File.expand_path File.join('../..', path), __FILE__
|
71
66
|
end
|
72
67
|
|
73
|
-
def self.run!(*args)
|
74
|
-
load 'lib/smartkiosk/sidekiq'
|
75
|
-
Sidekiq.startup!
|
76
|
-
super
|
77
|
-
end
|
78
|
-
|
79
68
|
def self.load_tasks!
|
80
69
|
require "sinatra/activerecord/rake"
|
81
70
|
Dir[File.expand_path "../../lib/tasks/*.rb", __FILE__].each {|file| require file}
|
82
71
|
end
|
83
72
|
|
84
73
|
def self.load_app!
|
74
|
+
load 'lib/smartkiosk/client/logging'
|
75
|
+
load 'lib/patches/sidekiq'
|
76
|
+
|
77
|
+
require_relative "../app/workers/orders/durable_order_execution"
|
78
|
+
|
85
79
|
%w(uploaders models workers controllers).each do |dir|
|
86
80
|
Dir[File.expand_path "../../app/#{dir}/**/*.rb", __FILE__].each {|file| require file }
|
87
81
|
end
|
88
82
|
|
89
|
-
|
83
|
+
CarrierWave.root = ->() { Application.public_folder }
|
84
|
+
|
85
|
+
self
|
90
86
|
end
|
91
87
|
|
92
88
|
def self.expand!(path)
|
@@ -102,5 +98,4 @@ module Smartkiosk
|
|
102
98
|
end
|
103
99
|
end
|
104
100
|
|
105
|
-
Application = Smartkiosk::Client
|
106
|
-
Application.load_app!
|
101
|
+
(Application = Smartkiosk::Client).load_app!
|
@@ -18,6 +18,10 @@ class CreatePayments < ActiveRecord::Migration
|
|
18
18
|
t.decimal :paid_amount, :precision => 38, :scale => 2
|
19
19
|
t.decimal :commission_amount, :precision => 38, :scale => 2
|
20
20
|
|
21
|
+
t.integer :payment_type
|
22
|
+
t.string :card_track1
|
23
|
+
t.string :card_track2
|
24
|
+
|
21
25
|
t.timestamps
|
22
26
|
end
|
23
27
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'smartkiosk/common'
|
2
|
+
|
1
3
|
module Smartkiosk
|
2
4
|
class Client
|
3
5
|
module Logging extend Smartkiosk::Common::Logging
|
@@ -10,6 +12,8 @@ module Smartkiosk
|
|
10
12
|
|
11
13
|
def call(env)
|
12
14
|
began_at = Time.now
|
15
|
+
|
16
|
+
env['rack.logger'] = Smartkiosk::Client::Logging.logger
|
13
17
|
status, header, body = @app.call(env)
|
14
18
|
header = Rack::Utils::HeaderHash.new(header)
|
15
19
|
log(env, status, header, began_at)
|