easypay 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +110 -0
- data/easypay.gemspec +2 -2
- data/lib/rails/generators/easypay/easypay_generator.rb +0 -30
- metadata +6 -6
- data/README.markdown +0 -57
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
Easypay
|
2
|
+
=========
|
3
|
+
|
4
|
+
_Easypay_ is a Ruby client for [Easypay](http://www.easypay.pt/) payment platform that allows payments with credit cards and (MB references to Portugal)
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
OK. First, you need to talk with people from Easypay to get your credentials!
|
10
|
+
|
11
|
+
Now, let's install the gem via Rubygems:
|
12
|
+
|
13
|
+
$ gem install easypay
|
14
|
+
|
15
|
+
Or in your Gemfile:
|
16
|
+
|
17
|
+
$ gem 'easypay'
|
18
|
+
|
19
|
+
After bundle:
|
20
|
+
|
21
|
+
$ rails generate easypay
|
22
|
+
$ rake db:migrate
|
23
|
+
|
24
|
+
Check on your initializers folder for easypay.rb and change the parameters:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
|
28
|
+
# CIN USER and ENTITY, are required
|
29
|
+
config.cin = 'cin provided by Easypay'
|
30
|
+
config.user = 'user provided by Easypay'
|
31
|
+
config.entity = 'entity provided by Easypay'
|
32
|
+
|
33
|
+
# Code is needed only if you don't have validation by IP Address
|
34
|
+
config.code = 'Code is needed only if you don't have validation by IP Address (Configure on Easypay Backoffice)'
|
35
|
+
|
36
|
+
# Change routes in order to work them on your app
|
37
|
+
config.easypay_notification_path = '/easypay/notifications.:format'
|
38
|
+
config.easypay_forward_path = '/easypay/forwards.:format'
|
39
|
+
config.easypay_payment_path = '/easypay/payments.:format'
|
40
|
+
config.redirect_after_payment_path = '/easypay/completed'
|
41
|
+
config.redirect_payment_notification_path = '/easypay/payment_completed'
|
42
|
+
```
|
43
|
+
|
44
|
+
Basic configuration
|
45
|
+
-----
|
46
|
+
|
47
|
+
In your model, add:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
acts_as_payable :name => 'your_model_name_attr_if_different_from_name',
|
51
|
+
:email => 'your_model_email_attr_if_different_from_email',
|
52
|
+
:mobile => 'your_model_mobile_attr_if_different_from_mobile',
|
53
|
+
:item_description => ''your_model_item_description_attr_if_different_from_item_description',
|
54
|
+
:item_quantity => 'your_model_item_quantity_attr_if_different_from_item_quantity',
|
55
|
+
:value => 'your_model_value_attr_if_different_from_value',
|
56
|
+
:description => 'your_model_description_attr_if_description_from_email',
|
57
|
+
:obs => 'your_model_obs_attr_if_different_from_obs'
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
How to?
|
62
|
+
------
|
63
|
+
|
64
|
+
In your controller:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
payment_reference = @bill.create_payment_reference
|
68
|
+
|
69
|
+
# check if success
|
70
|
+
|
71
|
+
if payment_reference[:success]
|
72
|
+
|
73
|
+
# access your payment_references easy
|
74
|
+
|
75
|
+
@bill.payment_references
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
You can work response (configure your routes on easypay.rb)
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
Easypay::PaymentReference.find_by_ep_key(params[:ep_key])
|
84
|
+
```
|
85
|
+
|
86
|
+
Delete or update payment reference:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# delete payment reference
|
90
|
+
@payment_reference.modify("delete")
|
91
|
+
|
92
|
+
# update
|
93
|
+
@payment_reference.modify("update")
|
94
|
+
```
|
95
|
+
|
96
|
+
Check Logs of every request and notification on table easypay_logs
|
97
|
+
|
98
|
+
Todo?
|
99
|
+
------
|
100
|
+
|
101
|
+
Feel free to contact me, you have your say.
|
102
|
+
|
103
|
+
I will put in github working project using gem
|
104
|
+
|
105
|
+
|
106
|
+
Copyright
|
107
|
+
------
|
108
|
+
Authors: Guilherme Pereira
|
109
|
+
|
110
|
+
|
data/easypay.gemspec
CHANGED
@@ -3,13 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "easypay"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.3"
|
7
7
|
s.authors = ["Guilherme Pereira"]
|
8
8
|
s.email = ["guiferrpereira@gmail.com"]
|
9
9
|
s.homepage = ""
|
10
10
|
s.summary = %q{This Gem provides connection to easypay API}
|
11
11
|
s.description = %q{This Gem provides connection to easypay API, that allow you to use credit cards and MB references to Portugal}
|
12
|
-
s.extra_rdoc_files = ["README.
|
12
|
+
s.extra_rdoc_files = ["README.md"]
|
13
13
|
|
14
14
|
s.rubyforge_project = "easypay"
|
15
15
|
|
@@ -23,35 +23,5 @@ class EasypayGenerator < Rails::Generators::Base
|
|
23
23
|
def copy_initializer_file
|
24
24
|
copy_file 'initializer.rb', 'config/initializers/easypay.rb'
|
25
25
|
end
|
26
|
-
|
27
|
-
# def update_application_template
|
28
|
-
# f = File.open "app/views/layouts/application.html.erb"
|
29
|
-
# layout = f.read; f.close
|
30
|
-
#
|
31
|
-
# if layout =~ /<%=[ ]+yield[ ]+%>/
|
32
|
-
# print " \e[1m\e[34mquestion\e[0m Your layouts/application.html.erb layout currently has the line <%= yield %>. This gem needs to change this line to <%= content_for?(:content) ? yield(:content) : yield %> to support its nested layouts. This change should not affect any of your existing layouts or views. Is this okay? [y/n] "
|
33
|
-
# begin
|
34
|
-
# answer = gets.chomp
|
35
|
-
# end while not answer =~ /[yn]/i
|
36
|
-
#
|
37
|
-
# if answer =~ /y/i
|
38
|
-
#
|
39
|
-
# layout.gsub!(/<%=[ ]+yield[ ]+%>/, '<%= content_for?(:content) ? yield(:content) : yield %>')
|
40
|
-
#
|
41
|
-
# tmp_real_path = File.expand_path("tmp/~application.html.erb")
|
42
|
-
#
|
43
|
-
# tmp = File.open tmp_real_path, "w"
|
44
|
-
# tmp.write layout; tmp.close
|
45
|
-
#
|
46
|
-
# remove_file 'app/views/layouts/application.html.erb'
|
47
|
-
# copy_file tmp_real_path, 'app/views/layouts/application.html.erb'
|
48
|
-
# remove_file tmp_real_path
|
49
|
-
# end
|
50
|
-
# elsif layout =~ /<%=[ ]+content_for\?\(:content\) \? yield\(:content\) : yield[ ]+%>/
|
51
|
-
# puts " \e[1m\e[33mskipping\e[0m layouts/application.html.erb modification is already done."
|
52
|
-
# else
|
53
|
-
# puts " \e[1m\e[31mconflict\e[0m The gem is confused by your layouts/application.html.erb. It does not contain the default line <%= yield %>, you may need to make manual changes to get this gem's nested layouts working. Visit ###### for details."
|
54
|
-
# end
|
55
|
-
# end
|
56
26
|
|
57
27
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Guilherme Pereira
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nokogiri
|
@@ -39,11 +39,11 @@ executables: []
|
|
39
39
|
extensions: []
|
40
40
|
|
41
41
|
extra_rdoc_files:
|
42
|
-
- README.
|
42
|
+
- README.md
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
45
|
- Gemfile
|
46
|
-
- README.
|
46
|
+
- README.md
|
47
47
|
- Rakefile
|
48
48
|
- VERSION
|
49
49
|
- app/controllers/easypay/notifications_controller.rb
|
data/README.markdown
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
Easypay
|
2
|
-
=========
|
3
|
-
|
4
|
-
_Easypay_ is a Ruby client for [Easypay](http://www.easypay.pt/) payment platform that allows payments with credit cards and (MB references to Portugal)
|
5
|
-
|
6
|
-
Installation
|
7
|
-
------------
|
8
|
-
|
9
|
-
OK. First, you need to talk with people from Easypay to get your credentials!
|
10
|
-
|
11
|
-
Now, let's install the gem via Rubygems:
|
12
|
-
|
13
|
-
$ gem install easypay
|
14
|
-
|
15
|
-
Or in your Gemfile:
|
16
|
-
|
17
|
-
$ gem 'easypay'
|
18
|
-
|
19
|
-
After bundle:
|
20
|
-
|
21
|
-
$ rails generate easypay
|
22
|
-
|
23
|
-
Check on your initializers folder for easypay.rb and change the parameters:
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
config.cin = 'CIN provided by Easypay'
|
27
|
-
config.user = 'USER provided by Easypay'
|
28
|
-
config.entity = 'Entity provided by Easypay'
|
29
|
-
config.code = 'Code is needed only if you don't have validation by IP Address (Configure on Easypay Backoffice)'
|
30
|
-
```
|
31
|
-
|
32
|
-
Usage
|
33
|
-
-----
|
34
|
-
|
35
|
-
Start Easypay call:
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
Easypay::Client.new
|
39
|
-
```
|
40
|
-
|
41
|
-
If you don't configure your easypay.rb with these params, you can start your object like this:
|
42
|
-
|
43
|
-
```ruby
|
44
|
-
Easypay::Client.new(:easypay_cin => xxxx,
|
45
|
-
:easypay_entity => xxxx,
|
46
|
-
:easypay_user => xxxx,
|
47
|
-
:easypay_code => xxxx,
|
48
|
-
:easypay_ref_type => xxx,
|
49
|
-
:easypay_country => xxxx)
|
50
|
-
```
|
51
|
-
|
52
|
-
In order to get one payment reference:
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
Easypay::Client.new.create_reference('token_you_generate', 'value_of_payment', 'client_language', 'client_name', 'client_mobile', 'client_email')
|
56
|
-
```
|
57
|
-
|