rubykassa 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -4
- data/lib/generators/rubykassa/templates/rubykassa.rb +3 -3
- data/lib/rubykassa/action_view_extension.rb +4 -3
- data/lib/rubykassa/configuration.rb +3 -3
- data/lib/rubykassa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 612e486181e1ee5501533f83ab6e331aca5f260b
|
4
|
+
data.tar.gz: 8b560867289cc9e919ab19c9a4823edad94e665c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb8a34b79e6684c3f3af9ed5854e7ca9157a49c13ed66aa1ddf0cd5de8ea7964d77668b38af2d2d9b99bb2d90d65fe2a22649d0676587d291fbc70bba8a25fea
|
7
|
+
data.tar.gz: 1ad1106701142d4e6b68f94e2eb01edc6102016116e28969b298138f60e13be1710c1235b17e807c926d486ef5182335cb2856f0dd92662562899ca5da83a252
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -48,9 +48,9 @@ To define custom success/fail callbacks you can also use the initializer:
|
|
48
48
|
|
49
49
|
Rubykassa.configure do |config|
|
50
50
|
...
|
51
|
-
config.success_callback = ->
|
52
|
-
config.fail_callback = ->
|
53
|
-
config.result_callback = ->
|
51
|
+
config.success_callback = ->(notification) { render text: 'success' }
|
52
|
+
config.fail_callback = ->(notification) { redirect_to root_path }
|
53
|
+
config.result_callback = ->(notification) { render text: notification.success }
|
54
54
|
end
|
55
55
|
|
56
56
|
Lambdas are called in RobokassaController so you can respond with [any kind that is supported by Rails](http://guides.rubyonrails.org/layouts_and_rendering.html#creating-responses).
|
@@ -70,7 +70,11 @@ Additionally you may want to pass extra options. There is no problem:
|
|
70
70
|
|
71
71
|
Or if you would like to pass some custom params use `custom` key in options hash:
|
72
72
|
|
73
|
-
<%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru, custom: { param1: "value1", param2: "value2" }} %>
|
73
|
+
<%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { description: "Invoice description", email: "foo@bar.com", currency: "WMZM", culture: :ru, custom: { param1: "value1", param2: "value2" }} %>
|
74
|
+
|
75
|
+
You can also pass some HTML options with `html` key in options hash (Bootstrap 3 example):
|
76
|
+
|
77
|
+
<%= pay_url "Pay with Robokassa", ivoice_id, total_sum, { html: { class: 'btn btn-primary btn-bg' }}
|
74
78
|
|
75
79
|
If you need to implement Robokassa's XML interface functionality you have to the following:
|
76
80
|
|
@@ -12,10 +12,10 @@ Rubykassa.configure do |config|
|
|
12
12
|
# was generated. It should always return "OK#{ invoice_id }" string, so implement
|
13
13
|
# your custom logic above `render text: notification.success` line
|
14
14
|
|
15
|
-
config.result_callback = ->
|
15
|
+
config.result_callback = ->(notification) { render text: notification.success }
|
16
16
|
|
17
17
|
# Define success or failure callbacks here like:
|
18
18
|
|
19
|
-
# config.success_callback = ->
|
20
|
-
# config.fail_callback = ->
|
19
|
+
# config.success_callback = ->(notification) { render text: 'success' }
|
20
|
+
# config.fail_callback = ->(notification) { redirect_to root_path }
|
21
21
|
end
|
@@ -3,9 +3,10 @@ module Rubykassa
|
|
3
3
|
module ActionViewExtension
|
4
4
|
def pay_url phrase, invoice_id, total, options = {}
|
5
5
|
total, invoice_id = total.to_s, invoice_id.to_s
|
6
|
-
extra_params = options.except(:custom)
|
6
|
+
extra_params = options.except([:custom, :html])
|
7
7
|
custom_params = options[:custom] ||= {}
|
8
|
-
|
8
|
+
html_params = options[:html] ||= {}
|
9
|
+
link_to phrase, Rubykassa.pay_url(invoice_id, total, custom_params, extra_params), html_params
|
9
10
|
end
|
10
11
|
end
|
11
|
-
end
|
12
|
+
end
|
@@ -15,9 +15,9 @@ module Rubykassa
|
|
15
15
|
self.mode = :test
|
16
16
|
self.http_method = :get
|
17
17
|
self.xml_http_method = :get
|
18
|
-
self.success_callback = ->
|
19
|
-
self.fail_callback = ->
|
20
|
-
self.result_callback = ->
|
18
|
+
self.success_callback = ->(notification) { render text: 'success' }
|
19
|
+
self.fail_callback = ->(notification) { render text: 'fail' }
|
20
|
+
self.result_callback = ->(notification) { render text: notification.success }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/rubykassa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubykassa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Kishenin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|