Module: FakePaymill
- Defined in:
- lib/fake_paymill.rb,
lib/fake_paymill/memory.rb,
lib/fake_paymill/server.rb,
lib/fake_paymill/helpers.rb,
lib/fake_paymill/version.rb,
lib/fake_paymill/sinatra_app.rb,
lib/fake_paymill/valid_credit_cards.rb
Defined Under Namespace
Modules: Helpers
Classes: Memory, Server, SinatraApp
Constant Summary
collapse
- VERSION =
"0.0.1"
- VALID_CREDIT_CARDS =
%w(
4111111111111111 5500000000000004
340000000000009 3530111333300000
6759000000000000 4973010000000004
30000000000004 6011111111111117
6240008631401148
)
- VALID_CREDIT_CARDS_3DSECURE =
%w(
4012888888881881 5169147129584558
)
Class Method Summary
collapse
Class Method Details
.boot_server ⇒ Object
35
36
37
|
# File 'lib/fake_paymill.rb', line 35
def self.boot_server
Server.new.boot
end
|
.clear! ⇒ Object
22
23
24
|
# File 'lib/fake_paymill.rb', line 22
def self.clear!
reset_log!
end
|
.log_file_path ⇒ Object
26
27
28
|
# File 'lib/fake_paymill.rb', line 26
def self.log_file_path
'tmp/log'
end
|
.logger ⇒ Object
45
46
47
|
# File 'lib/fake_paymill.rb', line 45
def self.logger
@logger
end
|
.logger=(logger) ⇒ Object
49
50
51
|
# File 'lib/fake_paymill.rb', line 49
def self.logger=(logger)
@logger = logger
end
|
.memory ⇒ Object
53
54
55
|
# File 'lib/fake_paymill.rb', line 53
def self.memory
@memory
end
|
.memory=(memory) ⇒ Object
57
58
59
|
# File 'lib/fake_paymill.rb', line 57
def self.memory=(memory)
@memory = memory
end
|
.reset_log! ⇒ Object
30
31
32
33
|
# File 'lib/fake_paymill.rb', line 30
def self.reset_log!
FileUtils.mkdir_p(File.dirname(log_file_path))
File.new(log_file_path, 'w').close
end
|
.set_configuration ⇒ Object
39
40
41
42
43
|
# File 'lib/fake_paymill.rb', line 39
def self.set_configuration
Paymill::Configuration.api_base = '0.0.0.0'
Paymill::Configuration.api_port = ENV['GATEWAY_PORT']
Paymill::Configuration.development = true
end
|
.start! ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/fake_paymill.rb', line 14
def self.start!
reset_log!
self.logger = Logger.new(log_file_path)
self.memory = Memory.new
boot_server
set_configuration
end
|