9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/generators/paypal_permissions/install_generator.rb', line 9
def update_configuration
dev_test_config = <<-DEV_TEST_CONFIG
#{Rails.application.class.name.split('::').first}::Application.configure do
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
permissions_options = {
:login => 'TODO: your PayPal sandbox caller login',
:password => 'TODO: your PayPal sandbox caller password',
:signature => 'TODO: your PayPal sandbox caller signature',
:app_id => 'APP-80W284485P519543T', # This is the app_id for all PayPal Permissions Service sandbox test apps
}
::PAYPAL_PERMISSIONS_GATEWAY = ActiveMerchant::Billing::PaypalPermissionsGateway.new(permissions_options)
end
end
DEV_TEST_CONFIG
prod_config = <<-PROD_CONFIG
#{Rails.application.class.name.split('::').first}::Application.configure do
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :production
permissions_options = {
:login => 'TODO: your PayPal live caller login',
:password => 'TODO: your PayPal live caller password',
:signature => 'TODO: your PayPal live caller signature',
:app_id => 'TODO: your PayPal live app id',
}
::PAYPAL_PERMISSIONS_GATEWAY = ActiveMerchant::Billing::PaypalPermissionsGateway.new(permissions_options)
end
end
PROD_CONFIG
append_file("config/environments/development.rb") do
"\n#{dev_test_config}"
end
append_file("config/environments/test.rb") do
"\n#{dev_test_config}"
end
append_file("config/environments/production.rb") do
"\n#{prod_config}"
end
end
|