easypay 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/easypay/notifications_controller.rb +17 -16
- data/app/controllers/easypay/payments_controller.rb +9 -0
- data/app/models/easypay/payment_reference.rb +7 -2
- data/app/views/easypay/notifications/notification_from_payment.xml.builder +11 -1
- data/app/views/easypay/payments/notify.html.erb +3 -0
- data/config/routes.rb +1 -0
- data/easypay.gemspec +1 -1
- data/lib/easypay/client.rb +1 -1
- data/lib/engine.rb +3 -0
- data/lib/rails/generators/easypay/templates/initializer.rb +2 -0
- metadata +5 -4
@@ -36,23 +36,24 @@ module Easypay
|
|
36
36
|
#ep_cin=8103&ep_user=OUTITUDE&ep_doc=TESTOUTITUDE0088690520120712152503
|
37
37
|
payment_detail = Easypay::Client.new.get_payment_detail("", params[:ep_doc])
|
38
38
|
|
39
|
-
payment_reference = PaymentReference.find_by_ep_reference_and_ep_key(payment_detail[:ep_reference], payment_detail[:t_key])
|
39
|
+
@payment_reference = PaymentReference.find_by_ep_reference_and_ep_key(payment_detail[:ep_reference], payment_detail[:t_key])
|
40
40
|
|
41
|
-
payment_reference.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
if @payment_reference.present? and !@payment_reference.ep_status.match('finalized')
|
42
|
+
|
43
|
+
@payment_reference.update_attributes(:ep_doc => payment_detail[:ep_doc],
|
44
|
+
:ep_payment_type => payment_detail[:ep_payment_type],
|
45
|
+
:ep_value_fixed => payment_detail[:ep_value_fixed],
|
46
|
+
:ep_value_var => payment_detail[:ep_value_var],
|
47
|
+
:ep_value_tax => payment_detail[:ep_value_tax],
|
48
|
+
:ep_value_transf => payment_detail[:ep_value_transf],
|
49
|
+
:ep_date_transf => payment_detail[:ep_date_transf],
|
50
|
+
:ep_date_read => payment_detail[:ep_date_read],
|
51
|
+
:ep_status_read => payment_detail[:ep_status_read],
|
52
|
+
:o_obs => payment_detail[:o_obs],
|
53
|
+
:ep_date => payment_detail[:ep_date],
|
54
|
+
:ep_status => 'finalized')
|
55
|
+
|
56
|
+
redirect_to payment_notify_url(:payable_id => @payment_reference.payable_id)
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
@@ -20,8 +20,13 @@ module Easypay
|
|
20
20
|
:ep_link => payment_reference[:payment_link],
|
21
21
|
:ep_last_status => payment_reference[:ep_status],
|
22
22
|
:request_log => payment_reference[:raw],
|
23
|
-
:item_description =>
|
24
|
-
:item_quantity =>
|
23
|
+
:item_description => self.item_description,
|
24
|
+
:item_quantity => self.item_quantity,
|
25
|
+
:o_name => self.o_name,
|
26
|
+
:o_description => self.o_description,
|
27
|
+
:o_obs => self.o_obs,
|
28
|
+
:o_email => self.o_email,
|
29
|
+
:o_mobile => self.o_mobile)
|
25
30
|
|
26
31
|
return payment_reference
|
27
32
|
else
|
@@ -1,4 +1,14 @@
|
|
1
1
|
xml.instruct! :xml, :version => "1.0", :encoding => "ISO-8859-1"
|
2
2
|
xml.get_detail do
|
3
|
-
|
3
|
+
if @payment_reference.nil?
|
4
|
+
xml.ep_status "err1"
|
5
|
+
xml.ep_message "payment reference not found"
|
6
|
+
else
|
7
|
+
xml.ep_status "ok0"
|
8
|
+
xml.ep_message "doc gerado"
|
9
|
+
xml.ep_cin @payment_reference.ep_cin
|
10
|
+
xml.ep_user @payment_reference.ep_user
|
11
|
+
xml.ep_doc @payment_reference.ep_doc
|
12
|
+
xml.ep_key @payment_reference.ep_key
|
13
|
+
end
|
4
14
|
end
|
data/config/routes.rb
CHANGED
@@ -4,5 +4,6 @@ Rails.application.routes.draw do
|
|
4
4
|
match Easypay::Engine.config.easypay_forward_path => 'easypay/notifications#notification_to_forward'
|
5
5
|
match Easypay::Engine.config.easypay_payment_path => 'easypay/notifications#notification_from_payment'
|
6
6
|
match Easypay::Engine.config.redirect_after_payment_path => 'easypay/payments#complete', :as => :payment_redirect
|
7
|
+
match Easypay::Engine.config.redirect_payment_notification_path => 'easypay/payments#notify', :as => :payment_notify
|
7
8
|
|
8
9
|
end
|
data/easypay.gemspec
CHANGED
data/lib/easypay/client.rb
CHANGED
@@ -40,7 +40,7 @@ module Easypay
|
|
40
40
|
:o_name => object.o_name.nil? ? "" : URI.escape(object.o_name),
|
41
41
|
:o_description => object.o_description.nil? ? "" : URI.escape(object.o_description),
|
42
42
|
:o_obs => object.o_obs.nil? ? "" : URI.escape(object.o_obs),
|
43
|
-
:o_mobile => object.o_mobile.nil? ? "" : object.o_mobile,
|
43
|
+
:o_mobile => object.o_mobile.nil? ? "" : URI.escape(object.o_mobile),
|
44
44
|
:o_email => object.o_email.nil? ? "" : URI.escape(object.o_email)
|
45
45
|
# :ep_rec => "yes", # Reccurrence stuff
|
46
46
|
# :ep_rec_freq => recurrence,
|
data/lib/engine.rb
CHANGED
@@ -11,6 +11,8 @@ module Easypay
|
|
11
11
|
config.easypay_forward_path = '/easypay/forwards.:format'
|
12
12
|
config.easypay_payment_path = '/easypay/payments.:format'
|
13
13
|
config.redirect_after_payment_path = '/easypay/completed'
|
14
|
+
config.redirect_payment_notification_path = '/easypay/payment_completed'
|
15
|
+
|
14
16
|
config.cin = 'cin provided by Easypay'
|
15
17
|
config.user = 'user provided by Easypay'
|
16
18
|
config.entity = 'entity provided by Easypay'
|
@@ -29,6 +31,7 @@ module Easypay
|
|
29
31
|
config.easypay_forward_path += '/' unless config.easypay_forward_path.last == '/'
|
30
32
|
config.easypay_payment_path += '/' unless config.easypay_payment_path.last == '/'
|
31
33
|
config.redirect_after_payment_path += '/' unless config.redirect_after_payment_path.last == '/'
|
34
|
+
config.redirect_payment_notification_path += '/' unless config.redirect_payment_notification_path.last == '/'
|
32
35
|
end
|
33
36
|
|
34
37
|
initializer "static assets" do |app|
|
@@ -5,6 +5,8 @@ module Easypay
|
|
5
5
|
config.easypay_forward_path = '/easypay/forwards.:format'
|
6
6
|
config.easypay_payment_path = '/easypay/payments.:format'
|
7
7
|
config.redirect_after_payment_path = '/easypay/completed'
|
8
|
+
config.redirect_payment_notification_path = '/easypay/payment_completed'
|
9
|
+
|
8
10
|
config.cin = 'cin provided by Easypay'
|
9
11
|
config.user = 'user provided by Easypay'
|
10
12
|
config.entity = 'entity provided by Easypay'
|
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: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
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-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nokogiri
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- app/views/easypay/notifications/notification_from_payment.xml.builder
|
54
54
|
- app/views/easypay/notifications/simple_notification.xml.builder
|
55
55
|
- app/views/easypay/payments/complete.html.erb
|
56
|
+
- app/views/easypay/payments/notify.html.erb
|
56
57
|
- config/routes.rb
|
57
58
|
- easypay.gemspec
|
58
59
|
- lib/acts_as_payable/base.rb
|