Module: GoPay
- Defined in:
- lib/gopay/crypt.rb,
lib/gopay/config.rb,
lib/gopay/railtie.rb,
lib/gopay/version.rb,
lib/gopay/models/base_payment.rb,
lib/gopay/models/payment_method.rb
Defined Under Namespace
Modules: Crypt
Classes: BasePayment, Configuration, PaymentMethod, Railtie
Constant Summary
collapse
- BASE_PATH =
File.expand_path("../../../", __FILE__)
- STATUSES =
{:created => "CREATED", :payment_method_chosen => "PAYMENT_METHOD_CHOSEN",
:paid => "PAID", :authorized => "AUTHORIZED",
:canceled => "CANCELED", :timeouted => "TIMEOUTED",
:refunded => "REFUNDED", :failed => "FAILED",
:call_completed => "CALL_COMPLETED", :call_failed => "CALL_FAILED",
:unknown => "UNKNOWN"}
- VERSION =
"0.2.1"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
17
18
19
|
# File 'lib/gopay/config.rb', line 17
def self.configuration
@configuration ||= Configuration.new
end
|
13
14
15
|
# File 'lib/gopay/config.rb', line 13
def self.configure
yield configuration
end
|
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/gopay/config.rb', line 31
def self.configure_from_rails
path = ::Rails.root.join("config", "gopay.yml")
configure_from_yaml(path) if File.exists?(path)
env = if defined?(::Rails) && ::Rails.respond_to?(:env)
::Rails.env.to_sym
elsif defined?(::RAILS_ENV)
::RAILS_ENV.to_sym
end
configuration.environment ||= (env == :development) ? :test : env
warn "GoPay wasnt properly configured." if GoPay.configuration.goid.blank?
configuration
end
|
21
22
23
24
25
26
27
28
29
|
# File 'lib/gopay/config.rb', line 21
def self.configure_from_yaml(path)
yaml = YAML.load_file(path)
return unless yaml
configuration.goid = yaml["goid"]
configuration.success_url = yaml["success_url"]
configuration.failed_url = yaml["failed_url"]
configuration.secure_key = yaml["secure_key"]
return configuration
end
|