pesapal 1.8.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +5 -15
- data/.rubocop.yml +18 -10
- data/.travis.yml +6 -4
- data/CHANGELOG.md +12 -1
- data/LICENSE.md +1 -1
- data/README.md +10 -15
- data/docs/.ruby-version +1 -0
- data/docs/Gemfile +4 -0
- data/docs/README.md +10 -0
- data/docs/_config.yml +27 -0
- data/docs/_includes/google-analytics.html +8 -0
- data/docs/_layouts/default.html +53 -0
- data/docs/assets/javascripts/scale.fix.js +17 -0
- data/docs/assets/stylesheets/pygment_trac.css +69 -0
- data/docs/assets/stylesheets/styles.css +287 -0
- data/docs/favicon.ico +0 -0
- data/docs/index.md +302 -0
- data/lib/pesapal.rb +0 -2
- data/lib/pesapal/helper/details.rb +5 -3
- data/lib/pesapal/helper/post.rb +5 -3
- data/lib/pesapal/helper/status.rb +8 -7
- data/lib/pesapal/merchant.rb +55 -141
- data/lib/pesapal/oauth.rb +13 -11
- data/lib/pesapal/version.rb +1 -1
- data/pesapal.gemspec +9 -4
- data/spec/pesapal_merchant_spec.rb +25 -86
- metadata +68 -34
- data/lib/generators/pesapal/install_generator.rb +0 -21
- data/lib/generators/templates/README.md +0 -21
- data/lib/generators/templates/pesapal.yml +0 -9
- data/lib/pesapal/railtie.rb +0 -26
@@ -1,21 +0,0 @@
|
|
1
|
-
# Since generators are not specific to this project, it's preferable you refer
|
2
|
-
# to the official documentation on the Rails site here;
|
3
|
-
# http://guides.rubyonrails.org/generators.html
|
4
|
-
module Pesapal
|
5
|
-
module Generators
|
6
|
-
# Install pesapal generator
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
8
|
-
source_root File.expand_path('../../templates', __FILE__)
|
9
|
-
|
10
|
-
desc 'Creates a Pesapal config file to your application.'
|
11
|
-
|
12
|
-
def copy_config
|
13
|
-
copy_file 'pesapal.yml', 'config/pesapal.yml'
|
14
|
-
end
|
15
|
-
|
16
|
-
def show_readme
|
17
|
-
readme 'README.md' if behavior == :invoke
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
How To Use Config File
|
3
|
-
----------------------
|
4
|
-
|
5
|
-
The Pesapal config file is in YAML format and looks something like this. Change
|
6
|
-
the values appropriately.
|
7
|
-
|
8
|
-
```
|
9
|
-
development:
|
10
|
-
callback_url: 'http://0.0.0.0:3000/pesapal/callback'
|
11
|
-
consumer_key: '<YOUR_CONSUMER_KEY>'
|
12
|
-
consumer_secret: '<YOUR_CONSUMER_SECRET>'
|
13
|
-
|
14
|
-
production:
|
15
|
-
callback_url: 'http://1.2.3.4:3000/pesapal/callback'
|
16
|
-
consumer_key: '<YOUR_CONSUMER_KEY>'
|
17
|
-
consumer_secret: '<YOUR_CONSUMER_SECRET>'
|
18
|
-
```
|
19
|
-
|
20
|
-
The config file can be found at `#{Rails.root}/config/pesapal.yml`.
|
21
|
-
|
@@ -1,9 +0,0 @@
|
|
1
|
-
development:
|
2
|
-
callback_url: 'http://0.0.0.0:3000/pesapal/callback'
|
3
|
-
consumer_key: '<YOUR_DEV_CONSUMER_KEY>'
|
4
|
-
consumer_secret: '<YOUR_DEV_CONSUMER_SECRET>'
|
5
|
-
|
6
|
-
production:
|
7
|
-
callback_url: 'http://1.2.3.4:3000/pesapal/callback'
|
8
|
-
consumer_key: '<YOUR_PROD_CONSUMER_KEY>'
|
9
|
-
consumer_secret: '<YOUR_PROD_CONSUMER_SECRET>'
|
data/lib/pesapal/railtie.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Pesapal
|
2
|
-
# Hooks Pesapal to extend Rails and/or modify the initialization process.
|
3
|
-
class Railtie < Rails::Railtie
|
4
|
-
# Loads pesapal credentials from initializer file depending on environment
|
5
|
-
# and fallback to default values if anything goes wrong.
|
6
|
-
initializer 'pesapal.load_credentials' do
|
7
|
-
path_to_yaml = "#{Rails.root}/config/pesapal.yml"
|
8
|
-
if File.exist?(path_to_yaml)
|
9
|
-
begin
|
10
|
-
config.pesapal_credentials = YAML.load(IO.read(path_to_yaml))[Rails.env]
|
11
|
-
rescue Errno::ENOENT
|
12
|
-
logger.info('YAML configuration file couldn\'t be found.')
|
13
|
-
return
|
14
|
-
rescue Psych::SyntaxError
|
15
|
-
logger.info('YAML configuration file contains invalid syntax. Will use using defaults.')
|
16
|
-
return
|
17
|
-
end
|
18
|
-
else
|
19
|
-
config.pesapal_credentials = { callback_url: 'http://0.0.0.0:3000/pesapal/callback',
|
20
|
-
consumer_key: '<YOUR_CONSUMER_KEY>',
|
21
|
-
consumer_secret: '<YOUR_CONSUMER_SECRET>'
|
22
|
-
}
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|